aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/server/loader.go
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2024-08-21 19:51:37 +0000
committerGitHub <noreply@github.com>2024-08-21 19:51:37 +0000
commit5c762aefcd8dded79e25bc2055254b4146e2b5a9 (patch)
tree5f5732b157c9cc889f345e08d0a831dd147f0d26 /plumbing/transport/server/loader.go
parent060f00f3e2b6fde3ca5e01227fed60d62e349fa5 (diff)
parent36756c91730bb3ccd0982703c90760a3621caf28 (diff)
downloadgo-git-5c762aefcd8dded79e25bc2055254b4146e2b5a9.tar.gz
Merge pull request #1170 from jakobmoellerdev/fs-load-non-baremaster
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