diff options
author | Jakob Möller <jmoller@redhat.com> | 2024-08-21 10:08:58 +0200 |
---|---|---|
committer | Jakob Möller <jmoller@redhat.com> | 2024-08-21 12:01:29 +0200 |
commit | 36756c91730bb3ccd0982703c90760a3621caf28 (patch) | |
tree | 111cd2555585fb69d5a4ff241c6584dd377038ef /plumbing/transport/server/loader.go | |
parent | 4fd9979d5c2940e72bdd6946fec21e02d959f0f6 (diff) | |
download | go-git-36756c91730bb3ccd0982703c90760a3621caf28.tar.gz |
plumbing: allow discovery of non bare repos in fsLoader
Diffstat (limited to 'plumbing/transport/server/loader.go')
-rw-r--r-- | plumbing/transport/server/loader.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plumbing/transport/server/loader.go b/plumbing/transport/server/loader.go index e7e2b07..f03a91c 100644 --- a/plumbing/transport/server/loader.go +++ b/plumbing/transport/server/loader.go @@ -40,8 +40,16 @@ func (l *fsLoader) Load(ep *transport.Endpoint) (storer.Storer, error) { return nil, err } - if _, err := fs.Stat("config"); err != nil { - return nil, transport.ErrRepositoryNotFound + var bare bool + if _, err := fs.Stat("config"); err == nil { + bare = true + } + + if !bare { + // do not use git.GitDirName due to import cycle + if _, err := fs.Stat(".git"); err != nil { + return nil, transport.ErrRepositoryNotFound + } } return filesystem.NewStorage(fs, cache.NewObjectLRUDefault()), nil |