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 <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Dec 12, 2014 at 09:56 UTC 553daf13ea25735ad60fa15c74c2bd266ab8e215
1 file changed +5 -5
builtin/reflog.c
+5 -5
@@ -23,13 +23,13 @@ static unsigned long default_reflog_expire_unreachable;
23 enum expire_reflog_flags {
24 EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
25 EXPIRE_REFLOGS_UPDATE_REF = 1 << 1,
26 - EXPIRE_REFLOGS_VERBOSE = 1 << 2
26 + EXPIRE_REFLOGS_VERBOSE = 1 << 2,
27 + EXPIRE_REFLOGS_REWRITE = 1 << 3
28 };
29
30 struct cmd_reflog_expire_cb {
31 struct rev_info revs;
32 int stalefix;
32 - int rewrite;
33 unsigned long expire_total;
34 unsigned long expire_unreachable;
35 int recno;
@@ -337,7 +337,7 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
337 struct expire_reflog_cb *cb = cb_data;
338 struct expire_reflog_policy_cb *policy_cb = cb->policy_cb;
339
340 - if (policy_cb->cmd->rewrite)
340 + if (cb->flags & EXPIRE_REFLOGS_REWRITE)
341 osha1 = policy_cb->last_kept_sha1;
342
343 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)
687 else if (!strcmp(arg, "--stale-fix"))
688 cb.stalefix = 1;
689 else if (!strcmp(arg, "--rewrite"))
690 - cb.rewrite = 1;
690 + flags |= EXPIRE_REFLOGS_REWRITE;
691 else if (!strcmp(arg, "--updateref"))
692 flags |= EXPIRE_REFLOGS_UPDATE_REF;
693 else if (!strcmp(arg, "--all"))
@@ -769,7 +769,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
769 if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
770 flags |= EXPIRE_REFLOGS_DRY_RUN;
771 else if (!strcmp(arg, "--rewrite"))
772 - cb.rewrite = 1;
772 + flags |= EXPIRE_REFLOGS_REWRITE;
773 else if (!strcmp(arg, "--updateref"))
774 flags |= EXPIRE_REFLOGS_UPDATE_REF;
775 else if (!strcmp(arg, "--verbose"))