Skip to content

Commit 994b328

Browse files
avargitster
authored andcommitted
reflog: reduce scope of "struct rev_info"
Change the "cmd.stalefix" handling added in 1389d9d (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent daf1d82 commit 994b328

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

builtin/reflog.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ static timestamp_t default_reflog_expire;
2828
static timestamp_t default_reflog_expire_unreachable;
2929

3030
struct cmd_reflog_expire_cb {
31-
struct rev_info revs;
3231
int stalefix;
3332
timestamp_t expire_total;
3433
timestamp_t expire_unreachable;
@@ -594,13 +593,15 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
594593
* from reflog if the repository was pruned with older git.
595594
*/
596595
if (cmd.stalefix) {
597-
repo_init_revisions(the_repository, &cmd.revs, prefix);
598-
cmd.revs.do_not_die_on_missing_tree = 1;
599-
cmd.revs.ignore_missing = 1;
600-
cmd.revs.ignore_missing_links = 1;
596+
struct rev_info revs;
597+
598+
repo_init_revisions(the_repository, &revs, prefix);
599+
revs.do_not_die_on_missing_tree = 1;
600+
revs.ignore_missing = 1;
601+
revs.ignore_missing_links = 1;
601602
if (flags & EXPIRE_REFLOGS_VERBOSE)
602603
printf(_("Marking reachable objects..."));
603-
mark_reachable_objects(&cmd.revs, 0, 0, NULL);
604+
mark_reachable_objects(&revs, 0, 0, NULL);
604605
if (flags & EXPIRE_REFLOGS_VERBOSE)
605606
putchar('\n');
606607
}

0 commit comments

Comments
 (0)