diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-03-10 00:03:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-10 00:03:43 +0100 |
commit | 586d45a14f4646e3d6280cb723d2cfb152a6a9f8 (patch) | |
tree | 14fbc2ef81a499fb47c1cf79393359d9737dc371 /storage/filesystem/dotgit/dotgit.go | |
parent | eef67789e846acc85e1ed2af2760d6716b2a9f07 (diff) | |
parent | 51320886176abed6647d2d7bab5bd6df17c4d44f (diff) | |
download | go-git-586d45a14f4646e3d6280cb723d2cfb152a6a9f8.tar.gz |
Merge pull request #6 from go-git/pr-1153
storage/filesystem: dotgit, unable to work with .git folder with temporal packfiles
Diffstat (limited to 'storage/filesystem/dotgit/dotgit.go')
-rw-r--r-- | storage/filesystem/dotgit/dotgit.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/storage/filesystem/dotgit/dotgit.go b/storage/filesystem/dotgit/dotgit.go index 111769b..7989e53 100644 --- a/storage/filesystem/dotgit/dotgit.go +++ b/storage/filesystem/dotgit/dotgit.go @@ -33,8 +33,9 @@ const ( tmpPackedRefsPrefix = "._packed-refs" - packExt = ".pack" - idxExt = ".idx" + packPrefix = "pack-" + packExt = ".pack" + idxExt = ".idx" ) var ( @@ -224,11 +225,11 @@ func (d *DotGit) objectPacks() ([]plumbing.Hash, error) { var packs []plumbing.Hash for _, f := range files { - if !strings.HasSuffix(f.Name(), packExt) { + n := f.Name() + if !strings.HasSuffix(n, packExt) || !strings.HasPrefix(n, packPrefix) { continue } - n := f.Name() h := plumbing.NewHash(n[5 : len(n)-5]) //pack-(hash).pack if h.IsZero() { // Ignore files with badly-formatted names. |