aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/server/loader.go
diff options
context:
space:
mode:
authorJakob Möller <jmoller@redhat.com>2024-08-21 10:08:58 +0200
committerJakob Möller <jmoller@redhat.com>2024-08-21 12:01:29 +0200
commit36756c91730bb3ccd0982703c90760a3621caf28 (patch)
tree111cd2555585fb69d5a4ff241c6584dd377038ef /plumbing/transport/server/loader.go
parent4fd9979d5c2940e72bdd6946fec21e02d959f0f6 (diff)
downloadgo-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.go12
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