]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-objects: use rev.filter when possible
authorDerrick Stolee <derrickstolee@github.com>
Wed, 9 Mar 2022 16:01:34 +0000 (16:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 9 Mar 2022 18:25:26 +0000 (10:25 -0800)
In builtin/pack-objects.c, we use a 'filter_options' global to populate
the --filter=<X> argument. The previous change created a pointer to a
filter option in 'struct rev_info', so we can use that pointer here as a
start to simplifying some usage of object filters.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c

index 87cb7b45c370e718a52fde5f87665cacc5770ee5..da0de0c3fe62a43fa8f3affe37ef1064827fd43a 100644 (file)
@@ -3651,7 +3651,7 @@ static int pack_options_allow_reuse(void)
 
 static int get_object_list_from_bitmap(struct rev_info *revs)
 {
-       if (!(bitmap_git = prepare_bitmap_walk(revs, &filter_options, 0)))
+       if (!(bitmap_git = prepare_bitmap_walk(revs, &revs->filter, 0)))
                return -1;
 
        if (pack_options_allow_reuse() &&
@@ -3727,6 +3727,7 @@ static void get_object_list(int ac, const char **av)
        repo_init_revisions(the_repository, &revs, NULL);
        save_commit_buffer = 0;
        setup_revisions(ac, av, &revs, &s_r_opt);
+       list_objects_filter_copy(&revs.filter, &filter_options);
 
        /* make sure shallows are read */
        is_repository_shallow(the_repository);
@@ -3777,7 +3778,7 @@ static void get_object_list(int ac, const char **av)
 
        if (!fn_show_object)
                fn_show_object = show_object;
-       traverse_commit_list_filtered(&filter_options, &revs,
+       traverse_commit_list_filtered(&revs.filter, &revs,
                                      show_commit, fn_show_object, NULL,
                                      NULL);