Skip to content

Commit b4d6280

Browse files
committed
Merge branch 'jk/maint-for-each-packed-object' into jk/cat-file-batch-all
* jk/maint-for-each-packed-object: for_each_packed_object: automatically open pack index
2 parents 67f0b6f + f813e9e commit b4d6280

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

sha1_file.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3566,14 +3566,19 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
35663566
{
35673567
struct packed_git *p;
35683568
int r = 0;
3569+
int pack_errors = 0;
35693570

35703571
prepare_packed_git();
35713572
for (p = packed_git; p; p = p->next) {
35723573
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
35733574
continue;
3575+
if (open_pack_index(p)) {
3576+
pack_errors = 1;
3577+
continue;
3578+
}
35743579
r = for_each_object_in_pack(p, cb, data);
35753580
if (r)
35763581
break;
35773582
}
3578-
return r;
3583+
return r ? r : pack_errors;
35793584
}

t/t5304-prune.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ test_expect_success 'gc: prune old objects after local clone' '
218218
'
219219

220220
test_expect_success 'garbage report in count-objects -v' '
221+
test_when_finished "rm -f .git/objects/pack/fake*" &&
221222
: >.git/objects/pack/foo &&
222223
: >.git/objects/pack/foo.bar &&
223224
: >.git/objects/pack/foo.keep &&

0 commit comments

Comments
 (0)