diff options
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c index a41cc4f65f..9711ef817d 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -3418,7 +3418,7 @@ static int loose_from_alt_odb(struct alternate_object_database *alt, return r; } -int for_each_loose_object(each_loose_object_fn cb, void *data) +int for_each_loose_object(each_loose_object_fn cb, void *data, unsigned flags) { struct loose_alt_odb_data alt; int r; @@ -3428,6 +3428,9 @@ int for_each_loose_object(each_loose_object_fn cb, void *data) if (r) return r; + if (flags & FOR_EACH_OBJECT_LOCAL_ONLY) + return 0; + alt.cb = cb; alt.data = data; return foreach_alt_odb(loose_from_alt_odb, &alt); @@ -3452,13 +3455,15 @@ static int for_each_object_in_pack(struct packed_git *p, each_packed_object_fn c return r; } -int for_each_packed_object(each_packed_object_fn cb, void *data) +int for_each_packed_object(each_packed_object_fn cb, void *data, unsigned flags) { struct packed_git *p; int r = 0; prepare_packed_git(); for (p = packed_git; p; p = p->next) { + if ((flags & FOR_EACH_OBJECT_LOCAL_ONLY) && !p->pack_local) + continue; r = for_each_object_in_pack(p, cb, data); if (r) break; |