Skip to content

Commit f0db732

Browse files
authored
Merge pull request #8 from bk2204/missing-pack-idx
pack/set: ignore packs without indices
2 parents fe8fbf7 + 561ed22 commit f0db732

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pack/set.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@ func NewSet(db string) (*Set, error) {
5555

5656
name := submatch[1]
5757

58-
packf, err := os.Open(filepath.Join(pd, fmt.Sprintf("pack-%s.pack", name)))
58+
idxf, err := os.Open(filepath.Join(pd, fmt.Sprintf("pack-%s.idx", name)))
5959
if err != nil {
60-
return nil, err
60+
// We have a pack (since it matched the regex), but the
61+
// index is missing or unusable. Skip this pack and
62+
// continue on with the next one, as Git does.
63+
continue
6164
}
6265

63-
idxf, err := os.Open(filepath.Join(pd, fmt.Sprintf("pack-%s.idx", name)))
66+
packf, err := os.Open(filepath.Join(pd, fmt.Sprintf("pack-%s.pack", name)))
6467
if err != nil {
6568
return nil, err
6669
}

0 commit comments

Comments
 (0)