diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-12-22 05:06:46 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-22 16:24:14 -0800 |
commit | 994b328f3662688d93233ed2215855e95d83e57a (patch) | |
tree | 5e44225463da70d7fc536c08dd4103ed2f96c95d /builtin/reflog.c | |
parent | reflog expire: don't use lookup_commit_reference_gently() (diff) | |
download | tgif-994b328f3662688d93233ed2215855e95d83e57a.tar.xz |
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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/reflog.c')
-rw-r--r-- | builtin/reflog.c | 13 |
1 files changed, 7 insertions, 6 deletions
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'); } |