aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/dotgit/dotgit.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-03-10 00:03:43 +0100
committerGitHub <noreply@github.com>2020-03-10 00:03:43 +0100
commit586d45a14f4646e3d6280cb723d2cfb152a6a9f8 (patch)
tree14fbc2ef81a499fb47c1cf79393359d9737dc371 /storage/filesystem/dotgit/dotgit.go
parenteef67789e846acc85e1ed2af2760d6716b2a9f07 (diff)
parent51320886176abed6647d2d7bab5bd6df17c4d44f (diff)
downloadgo-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.go9
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.