Summary
If you configure Flipt v2 to use local-backed storage with a path that has no files everything works fine.
However, if you point it to a path that has existing files but isn't a .git repo it returns an error with repository does not exist
Here is a simple reproduction.
Example
FS Layout
/tmp/flipt-v2-example » tree
.
├── config.yml
├── flags
│ └── features.yml
Config.yaml
log:
level: info
encoding: console
storage:
default:
name: "default"
backend:
type: local
path: "flags"
environments:
default:
name: "Default"
storage: "default"
default: true
The issue is around here:
|
} else { |
|
// opened successfully and there is contents so we assume not empty |
|
r.Repository, err = git.Open(storage, nil) |
|
if err != nil { |
|
return nil, empty, err |
|
} |
The culprit is git.Open, which expects an initialized git repo.
I tried to fix this in #4588 to no avail, and think we need to think a bit more on how to solve this.
Summary
If you configure Flipt v2 to use local-backed storage with a path that has no files everything works fine.
However, if you point it to a path that has existing files but isn't a .git repo it returns an error with
repository does not existHere is a simple reproduction.
Example
FS Layout
Config.yaml
The issue is around here:
flipt/internal/storage/git/repository.go
Lines 139 to 144 in d4e75d1
The culprit is git.Open, which expects an initialized git repo.
I tried to fix this in #4588 to no avail, and think we need to think a bit more on how to solve this.