Skip to content

Commit

Permalink
fix comment, fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Jan 22, 2024
1 parent 1bfc8f3 commit 07cf206
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/git/repo_base_gogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ func OpenRepository(ctx context.Context, repoPath string) (*Repository, error) {
return nil, err
}
}
// the "clone --shared" repo has alternative paths like "../../../../../../../../gitea-repositories/user2/repo-pull-request-target.git/objects", such relative path doesn't work well with go-git's AlternatesFS at the moment.
// the "clone --shared" repo doesn't work well with go-git AlternativeFS, https://github.com/go-git/go-git/issues/1006
// so use "/" for AlternatesFS, I guess it is the same behavior as current nogogit (no limitation or check for the "objects/info/alternates" paths), trust the "clone" command executed by the server.
altFs := osfs.New("/") // TODO: does it really work for Windows? Need some time to check.
var altFs billy.Filesystem

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-sqlite

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / test-pgsql

undefined: billy

Check failure on line 67 in modules/git/repo_base_gogit.go

View workflow job for this annotation

GitHub Actions / backend

undefined: billy
if setting.IsWindows {
altFs = osfs.New(filepath.VolumeName(setting.RepoRootPath) + "\\") // TODO: does it really work for Windows? Need some time to check.
} else {
altFs = osfs.New("/")
}
storage := filesystem.NewStorageWithOptions(fs, cache.NewObjectLRUDefault(), filesystem.Options{KeepDescriptors: true, LargeObjectThreshold: setting.Git.LargeObjectThreshold, AlternatesFS: altFs})
gogitRepo, err := gogit.Open(storage, fs)
if err != nil {
Expand Down

0 comments on commit 07cf206

Please sign in to comment.