[PATCH v2 12/24] expire_reflog(): move updateref to flags argument
From: Michael Haggerty <hidden>
Date: 2016-06-15 23:03:16
Subsystem:
the rest · Maintainer:
Linus Torvalds
The policy objects don't care about "--updateref". So move it to expire_reflog()'s flags parameter. Signed-off-by: Michael Haggerty <redacted> Reviewed-by: Stefan Beller <redacted> --- builtin/reflog.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 2f21735..e238fe0 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, "--")) {
--
2.1.3