Skip to content

Commit c4c4fbf

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

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

builtin/reflog.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ static unsigned long default_reflog_expire;
2121
static unsigned long default_reflog_expire_unreachable;
2222

2323
enum expire_reflog_flags {
24-
EXPIRE_REFLOGS_DRY_RUN = 1 << 0
24+
EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
25+
EXPIRE_REFLOGS_UPDATE_REF = 1 << 1
2526
};
2627

2728
struct cmd_reflog_expire_cb {
2829
struct rev_info revs;
2930
int stalefix;
3031
int rewrite;
31-
int updateref;
3232
int verbose;
3333
unsigned long expire_total;
3434
unsigned long expire_unreachable;
@@ -474,7 +474,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
474474
if (close_lock_file(&reflog_lock)) {
475475
status |= error("couldn't write %s: %s", log_file,
476476
strerror(errno));
477-
} else if (cmd->updateref &&
477+
} else if ((flags & EXPIRE_REFLOGS_UPDATE_REF) &&
478478
(write_in_full(lock->lock_fd,
479479
sha1_to_hex(cb.last_kept_sha1), 40) != 40 ||
480480
write_str_in_full(lock->lock_fd, "\n") != 1 ||
@@ -485,7 +485,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
485485
} else if (commit_lock_file(&reflog_lock)) {
486486
status |= error("unable to commit reflog '%s' (%s)",
487487
log_file, strerror(errno));
488-
} else if (cmd->updateref && commit_ref(lock)) {
488+
} else if ((flags & EXPIRE_REFLOGS_UPDATE_REF) && commit_ref(lock)) {
489489
status |= error("couldn't set %s", lock->ref_name);
490490
}
491491
}
@@ -677,7 +677,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
677677
else if (!strcmp(arg, "--rewrite"))
678678
cb.rewrite = 1;
679679
else if (!strcmp(arg, "--updateref"))
680-
cb.updateref = 1;
680+
flags |= EXPIRE_REFLOGS_UPDATE_REF;
681681
else if (!strcmp(arg, "--all"))
682682
do_all = 1;
683683
else if (!strcmp(arg, "--verbose"))
@@ -759,7 +759,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
759759
else if (!strcmp(arg, "--rewrite"))
760760
cb.rewrite = 1;
761761
else if (!strcmp(arg, "--updateref"))
762-
cb.updateref = 1;
762+
flags |= EXPIRE_REFLOGS_UPDATE_REF;
763763
else if (!strcmp(arg, "--verbose"))
764764
cb.verbose = 1;
765765
else if (!strcmp(arg, "--")) {

0 commit comments

Comments
 (0)