aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/reflog.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 2f21735be..e238fe036 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -21,14 +21,14 @@ static unsigned long default_reflog_expire;
static unsigned long default_reflog_expire_unreachable;
enum expire_reflog_flags {
- EXPIRE_REFLOGS_DRY_RUN = 1 << 0
+ EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
+ EXPIRE_REFLOGS_UPDATE_REF = 1 << 1
};
struct cmd_reflog_expire_cb {
struct rev_info revs;
int stalefix;
int rewrite;
- int updateref;
int verbose;
unsigned long expire_total;
unsigned long expire_unreachable;
@@ -474,7 +474,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
if (close_lock_file(&reflog_lock)) {
status |= error("couldn't write %s: %s", log_file,
strerror(errno));
- } else if (cmd->updateref &&
+ } else if ((flags & EXPIRE_REFLOGS_UPDATE_REF) &&
(write_in_full(lock->lock_fd,
sha1_to_hex(cb.last_kept_sha1), 40) != 40 ||
write_str_in_full(lock->lock_fd, "\n") != 1 ||
@@ -485,7 +485,7 @@ static int expire_reflog(const char *refname, const unsigned char *sha1,
} else if (commit_lock_file(&reflog_lock)) {
status |= error("unable to commit reflog '%s' (%s)",
log_file, strerror(errno));
- } else if (cmd->updateref && commit_ref(lock)) {
+ } else if ((flags & EXPIRE_REFLOGS_UPDATE_REF) && commit_ref(lock)) {
status |= error("couldn't set %s", lock->ref_name);
}
}
@@ -677,7 +677,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
else if (!strcmp(arg, "--rewrite"))
cb.rewrite = 1;
else if (!strcmp(arg, "--updateref"))
- cb.updateref = 1;
+ flags |= EXPIRE_REFLOGS_UPDATE_REF;
else if (!strcmp(arg, "--all"))
do_all = 1;
else if (!strcmp(arg, "--verbose"))
@@ -759,7 +759,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
else if (!strcmp(arg, "--rewrite"))
cb.rewrite = 1;
else if (!strcmp(arg, "--updateref"))
- cb.updateref = 1;
+ flags |= EXPIRE_REFLOGS_UPDATE_REF;
else if (!strcmp(arg, "--verbose"))
cb.verbose = 1;
else if (!strcmp(arg, "--")) {