mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 08:48:37 +00:00
committed by
Lunny Xiao
parent
b209531959
commit
33ad554800
20
vendor/gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit/dotgit.go
generated
vendored
20
vendor/gopkg.in/src-d/go-git.v4/storage/filesystem/dotgit/dotgit.go
generated
vendored
@@ -83,7 +83,7 @@ type DotGit struct {
|
||||
packList []plumbing.Hash
|
||||
packMap map[plumbing.Hash]struct{}
|
||||
|
||||
files map[string]billy.File
|
||||
files map[plumbing.Hash]billy.File
|
||||
}
|
||||
|
||||
// New returns a DotGit value ready to be used. The path argument must
|
||||
@@ -245,8 +245,15 @@ func (d *DotGit) objectPackPath(hash plumbing.Hash, extension string) string {
|
||||
}
|
||||
|
||||
func (d *DotGit) objectPackOpen(hash plumbing.Hash, extension string) (billy.File, error) {
|
||||
if d.files == nil {
|
||||
d.files = make(map[string]billy.File)
|
||||
if d.options.KeepDescriptors && extension == "pack" {
|
||||
if d.files == nil {
|
||||
d.files = make(map[plumbing.Hash]billy.File)
|
||||
}
|
||||
|
||||
f, ok := d.files[hash]
|
||||
if ok {
|
||||
return f, nil
|
||||
}
|
||||
}
|
||||
|
||||
err := d.hasPack(hash)
|
||||
@@ -255,11 +262,6 @@ func (d *DotGit) objectPackOpen(hash plumbing.Hash, extension string) (billy.Fil
|
||||
}
|
||||
|
||||
path := d.objectPackPath(hash, extension)
|
||||
f, ok := d.files[path]
|
||||
if ok {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
pack, err := d.fs.Open(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
@@ -270,7 +272,7 @@ func (d *DotGit) objectPackOpen(hash plumbing.Hash, extension string) (billy.Fil
|
||||
}
|
||||
|
||||
if d.options.KeepDescriptors && extension == "pack" {
|
||||
d.files[path] = pack
|
||||
d.files[hash] = pack
|
||||
}
|
||||
|
||||
return pack, nil
|
||||
|
Reference in New Issue
Block a user