]> git.ipfire.org Git - thirdparty/git.git/commitdiff
reflog: reduce scope of "struct rev_info"
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Wed, 22 Dec 2021 04:06:46 +0000 (05:06 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Dec 2021 00:24:14 +0000 (16:24 -0800)
Change the "cmd.stalefix" handling added in 1389d9ddaa6 (reflog expire
--fix-stale, 2007-01-06) to use a locally scoped "struct
rev_info". This code relies on mark_reachable_objects() twiddling
flags in the walked objects.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/reflog.c

index fe0bd353829a5e55155d09bc8a3f7d4168ff7781..4ff63846058a39771a40b9b9c0000da7d3b3004b 100644 (file)
@@ -28,7 +28,6 @@ static timestamp_t default_reflog_expire;
 static timestamp_t default_reflog_expire_unreachable;
 
 struct cmd_reflog_expire_cb {
-       struct rev_info revs;
        int stalefix;
        timestamp_t expire_total;
        timestamp_t expire_unreachable;
@@ -594,13 +593,15 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
         * from reflog if the repository was pruned with older git.
         */
        if (cmd.stalefix) {
-               repo_init_revisions(the_repository, &cmd.revs, prefix);
-               cmd.revs.do_not_die_on_missing_tree = 1;
-               cmd.revs.ignore_missing = 1;
-               cmd.revs.ignore_missing_links = 1;
+               struct rev_info revs;
+
+               repo_init_revisions(the_repository, &revs, prefix);
+               revs.do_not_die_on_missing_tree = 1;
+               revs.ignore_missing = 1;
+               revs.ignore_missing_links = 1;
                if (flags & EXPIRE_REFLOGS_VERBOSE)
                        printf(_("Marking reachable objects..."));
-               mark_reachable_objects(&cmd.revs, 0, 0, NULL);
+               mark_reachable_objects(&revs, 0, 0, NULL);
                if (flags & EXPIRE_REFLOGS_VERBOSE)
                        putchar('\n');
        }