Skip to content

Commit 80f6de4

Browse files
derrickstoleegitster
authored andcommitted
pack-objects: move revs out of get_object_list()
We intend to parse the --filter option directly into revs.filter, but we first need to move the 'revs' variable out of get_object_list() and pass it as a pointer instead. This change only deals with the issues of making that work. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cc91044 commit 80f6de4

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

builtin/pack-objects.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3714,20 +3714,19 @@ static void mark_bitmap_preferred_tips(void)
37143714
}
37153715
}
37163716

3717-
static void get_object_list(int ac, const char **av)
3717+
static void get_object_list(struct rev_info *revs, int ac, const char **av)
37183718
{
3719-
struct rev_info revs;
37203719
struct setup_revision_opt s_r_opt = {
37213720
.allow_exclude_promisor_objects = 1,
37223721
};
37233722
char line[1000];
37243723
int flags = 0;
37253724
int save_warning;
37263725

3727-
repo_init_revisions(the_repository, &revs, NULL);
3726+
repo_init_revisions(the_repository, revs, NULL);
37283727
save_commit_buffer = 0;
3729-
setup_revisions(ac, av, &revs, &s_r_opt);
3730-
list_objects_filter_copy(&revs.filter, &filter_options);
3728+
setup_revisions(ac, av, revs, &s_r_opt);
3729+
list_objects_filter_copy(&revs->filter, &filter_options);
37313730

37323731
/* make sure shallows are read */
37333732
is_repository_shallow(the_repository);
@@ -3757,13 +3756,13 @@ static void get_object_list(int ac, const char **av)
37573756
}
37583757
die(_("not a rev '%s'"), line);
37593758
}
3760-
if (handle_revision_arg(line, &revs, flags, REVARG_CANNOT_BE_FILENAME))
3759+
if (handle_revision_arg(line, revs, flags, REVARG_CANNOT_BE_FILENAME))
37613760
die(_("bad revision '%s'"), line);
37623761
}
37633762

37643763
warn_on_object_refname_ambiguity = save_warning;
37653764

3766-
if (use_bitmap_index && !get_object_list_from_bitmap(&revs))
3765+
if (use_bitmap_index && !get_object_list_from_bitmap(revs))
37673766
return;
37683767

37693768
if (use_delta_islands)
@@ -3772,24 +3771,24 @@ static void get_object_list(int ac, const char **av)
37723771
if (write_bitmap_index)
37733772
mark_bitmap_preferred_tips();
37743773

3775-
if (prepare_revision_walk(&revs))
3774+
if (prepare_revision_walk(revs))
37763775
die(_("revision walk setup failed"));
3777-
mark_edges_uninteresting(&revs, show_edge, sparse);
3776+
mark_edges_uninteresting(revs, show_edge, sparse);
37783777

37793778
if (!fn_show_object)
37803779
fn_show_object = show_object;
3781-
traverse_commit_list(&revs,
3780+
traverse_commit_list(revs,
37823781
show_commit, fn_show_object,
37833782
NULL);
37843783

37853784
if (unpack_unreachable_expiration) {
3786-
revs.ignore_missing_links = 1;
3787-
if (add_unseen_recent_objects_to_traversal(&revs,
3785+
revs->ignore_missing_links = 1;
3786+
if (add_unseen_recent_objects_to_traversal(revs,
37883787
unpack_unreachable_expiration))
37893788
die(_("unable to add recent objects"));
3790-
if (prepare_revision_walk(&revs))
3789+
if (prepare_revision_walk(revs))
37913790
die(_("revision walk setup failed"));
3792-
traverse_commit_list(&revs, record_recent_commit,
3791+
traverse_commit_list(revs, record_recent_commit,
37933792
record_recent_object, NULL);
37943793
}
37953794

@@ -3872,6 +3871,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
38723871
int rev_list_index = 0;
38733872
int stdin_packs = 0;
38743873
struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
3874+
struct rev_info revs;
3875+
38753876
struct option pack_objects_options[] = {
38763877
OPT_SET_INT('q', "quiet", &progress,
38773878
N_("do not show progress meter"), 0),
@@ -3976,6 +3977,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
39763977

39773978
read_replace_refs = 0;
39783979

3980+
repo_init_revisions(the_repository, &revs, NULL);
3981+
39793982
sparse = git_env_bool("GIT_TEST_PACK_SPARSE", -1);
39803983
if (the_repository->gitdir) {
39813984
prepare_repo_settings(the_repository);
@@ -4154,7 +4157,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
41544157
} else if (!use_internal_rev_list) {
41554158
read_object_list_from_stdin();
41564159
} else {
4157-
get_object_list(rp.nr, rp.v);
4160+
get_object_list(&revs, rp.nr, rp.v);
41584161
}
41594162
cleanup_preferred_base();
41604163
if (include_tag && nr_result)

0 commit comments

Comments
 (0)