diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2014-12-12 09:56:51 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-12-12 11:43:48 -0800 |
commit | c4c4fbf86cd6f3d4fee629629d1f7e2e5d81d592 (patch) | |
tree | 9c9d2d5d8fe5aff20f93b3d050c6fa691d2c2cbb /builtin | |
parent | expire_reflog(): move dry_run to flags argument (diff) | |
download | tgif-c4c4fbf86cd6f3d4fee629629d1f7e2e5d81d592.tar.xz |
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 <mhagger@alum.mit.edu>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/reflog.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c index 2f21735be9..e238fe036c 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, "--")) { |