3793
return 0;
3794
}
3795
3796
-static void read_packs_list_from_stdin(void)
3796
+static void read_packs_list_from_stdin(struct rev_info *revs)
3797
{
3798
struct strbuf buf = STRBUF_INIT;
3799
struct string_list include_packs = STRING_LIST_INIT_DUP;
3801
struct string_list_item *item = NULL;
3802
3803
struct packed_git *p;
3804
- struct rev_info revs;
3805
-
3806
- repo_init_revisions(the_repository, &revs, NULL);
3807
- /*
3808
- * Use a revision walk to fill in the namehash of objects in the include
3809
- * packs. To save time, we'll avoid traversing through objects that are
3810
- * in excluded packs.
3811
- *
3812
- * That may cause us to avoid populating all of the namehash fields of
3813
- * all included objects, but our goal is best-effort, since this is only
3814
- * an optimization during delta selection.
3815
- */
3816
- revs.no_kept_objects = 1;
3817
- revs.keep_pack_cache_flags |= IN_CORE_KEEP_PACKS;
3818
- revs.blob_objects = 1;
3819
- revs.tree_objects = 1;
3820
- revs.tag_objects = 1;
3821
- revs.ignore_missing_links = 1;
3804
3805
while (strbuf_getline(&buf, stdin) != EOF) {
3806
if (!buf.len)
3870
struct packed_git *p = item->util;
3871
for_each_object_in_pack(p,
3872
add_object_entry_from_pack,
3891
- &revs,
3873
+ revs,
3874
FOR_EACH_OBJECT_PACK_ORDER);
3875
}
3876
3895
- if (prepare_revision_walk(&revs))
3896
- die(_("revision walk setup failed"));
3897
- traverse_commit_list(&revs,
3898
- show_commit_pack_hint,
3899
- show_object_pack_hint,
3900
- NULL);
3901
-
3902
- trace2_data_intmax("pack-objects", the_repository, "stdin_packs_found",
3903
- stdin_packs_found_nr);
3904
- trace2_data_intmax("pack-objects", the_repository, "stdin_packs_hints",
3905
- stdin_packs_hints_nr);
3906
-
3877
strbuf_release(&buf);
3878
string_list_clear(&include_packs, 0);
3879
string_list_clear(&exclude_packs, 0);
3883
3884
static void read_stdin_packs(int rev_list_unpacked)
3885
{
3886
+ struct rev_info revs;
3887
+
3888
+ repo_init_revisions(the_repository, &revs, NULL);
3889
+ /*
3890
+ * Use a revision walk to fill in the namehash of objects in the include
3891
+ * packs. To save time, we'll avoid traversing through objects that are
3892
+ * in excluded packs.
3893
+ *
3894
+ * That may cause us to avoid populating all of the namehash fields of
3895
+ * all included objects, but our goal is best-effort, since this is only
3896
+ * an optimization during delta selection.
3897
+ */
3898
+ revs.no_kept_objects = 1;
3899
+ revs.keep_pack_cache_flags |= IN_CORE_KEEP_PACKS;
3900
+ revs.blob_objects = 1;
3901
+ revs.tree_objects = 1;
3902
+ revs.tag_objects = 1;
3903
+ revs.ignore_missing_links = 1;
3904
+
3905
/* avoids adding objects in excluded packs */
3906
ignore_packed_keep_in_core = 1;
3918
- read_packs_list_from_stdin();
3907
+ read_packs_list_from_stdin(&revs);
3908
if (rev_list_unpacked)
3909
add_unreachable_loose_objects();
3910
+
3911
+ if (prepare_revision_walk(&revs))
3912
+ die(_("revision walk setup failed"));
3913
+ traverse_commit_list(&revs,
3914
+ show_commit_pack_hint,
3915
+ show_object_pack_hint,
3916
+ NULL);
3917
+
3918
+ trace2_data_intmax("pack-objects", the_repository, "stdin_packs_found",
3919
+ stdin_packs_found_nr);
3920
+ trace2_data_intmax("pack-objects", the_repository, "stdin_packs_hints",
3921
+ stdin_packs_hints_nr);
3922
}
3923
3924
static void add_cruft_object_entry(const struct object_id *oid, enum object_type type,