From: Ævar Arnfjörð Bjarmason Date: Wed, 22 Dec 2021 04:06:46 +0000 (+0100) Subject: reflog: reduce scope of "struct rev_info" X-Git-Tag: v2.35.0-rc0~12^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=994b328f3662688d93233ed2215855e95d83e57a;p=thirdparty%2Fgit.git reflog: reduce scope of "struct rev_info" 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin/reflog.c b/builtin/reflog.c index fe0bd35382..4ff6384605 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -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'); }