Skip to content

Commit bc11155

Browse files
mhaggergitster
authored andcommitted
expire_reflog(): move verbose to flags argument
The policy objects don't care about "--verbose". 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 8c22dd3 commit bc11155

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

builtin/reflog.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ static unsigned long default_reflog_expire_unreachable;
2222

2323
enum expire_reflog_flags {
2424
EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
25-
EXPIRE_REFLOGS_UPDATE_REF = 1 << 1
25+
EXPIRE_REFLOGS_UPDATE_REF = 1 << 1,
26+
EXPIRE_REFLOGS_VERBOSE = 1 << 2
2627
};
2728

2829
struct cmd_reflog_expire_cb {
2930
struct rev_info revs;
3031
int stalefix;
3132
int rewrite;
32-
int verbose;
3333
unsigned long expire_total;
3434
unsigned long expire_unreachable;
3535
int recno;
@@ -344,7 +344,7 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
344344
message, policy_cb)) {
345345
if (!policy_cb->newlog)
346346
printf("would prune %s", message);
347-
else if (policy_cb->cmd->verbose)
347+
else if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
348348
printf("prune %s", message);
349349
} else {
350350
if (policy_cb->newlog) {
@@ -356,7 +356,7 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
356356
message);
357357
hashcpy(policy_cb->last_kept_sha1, nsha1);
358358
}
359-
if (policy_cb->cmd->verbose)
359+
if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
360360
printf("keep %s", message);
361361
}
362362
return 0;
@@ -693,7 +693,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
693693
else if (!strcmp(arg, "--all"))
694694
do_all = 1;
695695
else if (!strcmp(arg, "--verbose"))
696-
cb.verbose = 1;
696+
flags |= EXPIRE_REFLOGS_VERBOSE;
697697
else if (!strcmp(arg, "--")) {
698698
i++;
699699
break;
@@ -711,10 +711,10 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
711711
*/
712712
if (cb.stalefix) {
713713
init_revisions(&cb.revs, prefix);
714-
if (cb.verbose)
714+
if (flags & EXPIRE_REFLOGS_VERBOSE)
715715
printf("Marking reachable objects...");
716716
mark_reachable_objects(&cb.revs, 0, 0, NULL);
717-
if (cb.verbose)
717+
if (flags & EXPIRE_REFLOGS_VERBOSE)
718718
putchar('\n');
719719
}
720720

@@ -773,7 +773,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
773773
else if (!strcmp(arg, "--updateref"))
774774
flags |= EXPIRE_REFLOGS_UPDATE_REF;
775775
else if (!strcmp(arg, "--verbose"))
776-
cb.verbose = 1;
776+
flags |= EXPIRE_REFLOGS_VERBOSE;
777777
else if (!strcmp(arg, "--")) {
778778
i++;
779779
break;

0 commit comments

Comments
 (0)