Skip to content

Commit

Permalink
expire_reflog(): move updateref to flags argument
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Dec 12, 2014
1 parent 98f31d8 commit c4c4fbf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions builtin/reflog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 ||
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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, "--")) {
Expand Down

0 comments on commit c4c4fbf

Please sign in to comment.