From 994b328f3662688d93233ed2215855e95d83e57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 22 Dec 2021 05:06:46 +0100 Subject: reflog: reduce scope of "struct rev_info" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- builtin/reflog.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'builtin/reflog.c') 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'); } -- cgit v1.2.3