mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-12 08:18:23 +00:00
refactor: remove Path field from git.Repository (#38552)
The "path" details should be hidden to other packages By the way, fix a resource leaking in gogit's CommitNodeIndex (the file was not closed in CacheCommit)
This commit is contained in:
@@ -9,6 +9,7 @@ package git
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"gitea.dev/modules/git/gitcmd"
|
||||
"gitea.dev/modules/setting"
|
||||
|
||||
"github.com/go-git/go-billy/v5"
|
||||
@@ -29,7 +30,8 @@ type Repository struct {
|
||||
}
|
||||
|
||||
func openRepositoryInternal(gitRepo *Repository) error {
|
||||
fs := osfs.New(gitRepo.Path)
|
||||
repoPath := gitcmd.RepoLocalPath(gitRepo)
|
||||
fs := osfs.New(repoPath)
|
||||
_, err := fs.Stat(".git")
|
||||
if err == nil {
|
||||
fs, err = fs.Chroot(".git")
|
||||
|
||||
Reference in New Issue
Block a user