summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-07-09 21:31:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-09 21:31:43 (GMT)
commitc07173f2156cb81661f0a9c33b99d9378f3e104c (patch)
treeaf6ff089cac7784bd70bd5a7850467a77bd7318e /sha1_file.c
parent0bf46af089cd01516c298a97f72f360fdbe6df85 (diff)
parentf813e9ea5f776ff82a4462c5e9405f2e904254f4 (diff)
downloadgit-c07173f2156cb81661f0a9c33b99d9378f3e104c.zip
git-c07173f2156cb81661f0a9c33b99d9378f3e104c.tar.gz
git-c07173f2156cb81661f0a9c33b99d9378f3e104c.tar.bz2
Merge branch 'jk/maint-for-each-packed-object'
The for_each_packed_object() API function did not iterate over objects in a packfile that hasn't been used yet. * jk/maint-for-each-packed-object: for_each_packed_object: automatically open pack index
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 77cd81d..c0205a0 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -3575,14 +3575,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;
}