Skip to content

Commit 553daf1

Browse files
mhaggergitster
authored andcommitted
expire_reflog(): move rewrite to flags argument
The policy objects don't care about "--rewrite". So move it to expire_reflog()'s flags parameter. Signed-off-by: Michael Haggerty <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc11155 commit 553daf1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

builtin/reflog.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ static unsigned long default_reflog_expire_unreachable;
2323
enum expire_reflog_flags {
2424
EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
2525
EXPIRE_REFLOGS_UPDATE_REF = 1 << 1,
26-
EXPIRE_REFLOGS_VERBOSE = 1 << 2
26+
EXPIRE_REFLOGS_VERBOSE = 1 << 2,
27+
EXPIRE_REFLOGS_REWRITE = 1 << 3
2728
};
2829

2930
struct cmd_reflog_expire_cb {
3031
struct rev_info revs;
3132
int stalefix;
32-
int rewrite;
3333
unsigned long expire_total;
3434
unsigned long expire_unreachable;
3535
int recno;
@@ -337,7 +337,7 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
337337
struct expire_reflog_cb *cb = cb_data;
338338
struct expire_reflog_policy_cb *policy_cb = cb->policy_cb;
339339

340-
if (policy_cb->cmd->rewrite)
340+
if (cb->flags & EXPIRE_REFLOGS_REWRITE)
341341
osha1 = policy_cb->last_kept_sha1;
342342

343343
if (should_expire_reflog_ent(osha1, nsha1, email, timestamp, tz,
@@ -687,7 +687,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
687687
else if (!strcmp(arg, "--stale-fix"))
688688
cb.stalefix = 1;
689689
else if (!strcmp(arg, "--rewrite"))
690-
cb.rewrite = 1;
690+
flags |= EXPIRE_REFLOGS_REWRITE;
691691
else if (!strcmp(arg, "--updateref"))
692692
flags |= EXPIRE_REFLOGS_UPDATE_REF;
693693
else if (!strcmp(arg, "--all"))
@@ -769,7 +769,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
769769
if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
770770
flags |= EXPIRE_REFLOGS_DRY_RUN;
771771
else if (!strcmp(arg, "--rewrite"))
772-
cb.rewrite = 1;
772+
flags |= EXPIRE_REFLOGS_REWRITE;
773773
else if (!strcmp(arg, "--updateref"))
774774
flags |= EXPIRE_REFLOGS_UPDATE_REF;
775775
else if (!strcmp(arg, "--verbose"))

0 commit comments

Comments
 (0)