On Fri, Dec 05, 2014 at 12:08:24AM +0100, Michael Haggerty wrote:
> The policy objects don't care about "--updateref". So move it to
> expire_reflog()'s flags parameter.
> 
> Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu>

Reviewed-by: <sbel...@google.com>

> ---
>  builtin/reflog.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/builtin/reflog.c b/builtin/reflog.c
> index a490193..597c547 100644
> --- a/builtin/reflog.c
> +++ b/builtin/reflog.c
> @@ -24,7 +24,6 @@ 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;
> @@ -415,7 +414,8 @@ static void reflog_expiry_cleanup(struct expire_reflog_cb 
> *cb)
>  static struct lock_file reflog_lock;
>  
>  enum expire_reflog_flags {
> -     EXPIRE_REFLOGS_DRY_RUN = 1 << 0
> +     EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
> +     EXPIRE_REFLOGS_UPDATE_REF = 1 << 1
>  };
>  
>  static int expire_reflog(const char *refname, const unsigned char *sha1,
> @@ -460,7 +460,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 ||
> @@ -471,7 +471,7 @@ static int expire_reflog(const char *refname, const 
> unsigned char *sha1,
>               } else if (commit_lock_file(&reflog_lock)) {
>                       status |= error("cannot rename %s.lock to %s",
>                                       log_file, log_file);
> -             } 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);
>               }
>       }
> @@ -663,7 +663,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"))
> @@ -745,7 +745,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
> 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to