Skip to content

v2: Local backed storage with existing files returns 'repository does not exist' error #4589

@markphelps

Description

@markphelps

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementCreated by Linear-GitHub Syncv2Flipt v2

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions