Skip to content

Commit

Permalink
Merge branch 'jk/maint-for-each-packed-object' into jk/cat-file-batch…
Browse files Browse the repository at this point in the history
…-all

* jk/maint-for-each-packed-object:
  for_each_packed_object: automatically open pack index
  • Loading branch information
Junio C Hamano committed Jun 22, 2015
2 parents 67f0b6f + f813e9e commit b4d6280
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sha1_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3566,14 +3566,19 @@ int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags)
{
struct packed_git *p;
int r = 0;
int pack_errors = 0;

prepare_packed_git();
for (p = packed_git; p; p = p->next) {
if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local)
continue;
if (open_pack_index(p)) {
pack_errors = 1;
continue;
}
r = for_each_object_in_pack(p, cb, data);
if (r)
break;
}
return r;
return r ? r : pack_errors;
}
1 change: 1 addition & 0 deletions t/t5304-prune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ test_expect_success 'gc: prune old objects after local clone' '
'

test_expect_success 'garbage report in count-objects -v' '
test_when_finished "rm -f .git/objects/pack/fake*" &&
: >.git/objects/pack/foo &&
: >.git/objects/pack/foo.bar &&
: >.git/objects/pack/foo.keep &&
Expand Down

0 comments on commit b4d6280

Please sign in to comment.