Re: [PATCH 17/23] expire_reflog(): move rewrite to flags argument

2014-12-08 Thread Stefan Beller
On Fri, Dec 05, 2014 at 12:08:29AM +0100, Michael Haggerty wrote:
> The policy objects don't care about "--rewrite". So move it to
> expire_reflog()'s flags parameter.
> 
> Signed-off-by: Michael Haggerty 

Reviewed-by: Stefan Beller 

> ---
>  builtin/reflog.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/builtin/reflog.c b/builtin/reflog.c
> index cc7a220..6294406 100644
> --- a/builtin/reflog.c
> +++ b/builtin/reflog.c
> @@ -23,13 +23,13 @@ static unsigned long default_reflog_expire_unreachable;
>  enum expire_reflog_flags {
>   EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
>   EXPIRE_REFLOGS_UPDATE_REF = 1 << 1,
> - EXPIRE_REFLOGS_VERBOSE = 1 << 2
> + EXPIRE_REFLOGS_VERBOSE = 1 << 2,
> + EXPIRE_REFLOGS_REWRITE = 1 << 3
>  };
>  
>  struct cmd_reflog_expire_cb {
>   struct rev_info revs;
>   int stalefix;
> - int rewrite;
>   unsigned long expire_total;
>   unsigned long expire_unreachable;
>   int recno;
> @@ -337,7 +337,7 @@ static int expire_reflog_ent(unsigned char *osha1, 
> unsigned char *nsha1,
>   struct expire_reflog_cb *cb = cb_data;
>   struct expire_reflog_policy_cb *policy_cb = cb->policy_cb;
>  
> - if (policy_cb->cmd->rewrite)
> + if (cb->flags & EXPIRE_REFLOGS_REWRITE)
>   osha1 = policy_cb->last_kept_sha1;
>  
>   if (should_expire_reflog_ent(osha1, nsha1, email, timestamp, tz,
> @@ -673,7 +673,7 @@ static int cmd_reflog_expire(int argc, const char **argv, 
> const char *prefix)
>   else if (!strcmp(arg, "--stale-fix"))
>   cb.stalefix = 1;
>   else if (!strcmp(arg, "--rewrite"))
> - cb.rewrite = 1;
> + flags |= EXPIRE_REFLOGS_REWRITE;
>   else if (!strcmp(arg, "--updateref"))
>   flags |= EXPIRE_REFLOGS_UPDATE_REF;
>   else if (!strcmp(arg, "--all"))
> @@ -755,7 +755,7 @@ static int cmd_reflog_delete(int argc, const char **argv, 
> const char *prefix)
>   if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
>   flags |= EXPIRE_REFLOGS_DRY_RUN;
>   else if (!strcmp(arg, "--rewrite"))
> - cb.rewrite = 1;
> + flags |= EXPIRE_REFLOGS_REWRITE;
>   else if (!strcmp(arg, "--updateref"))
>   flags |= EXPIRE_REFLOGS_UPDATE_REF;
>   else if (!strcmp(arg, "--verbose"))
> -- 
> 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


[PATCH 17/23] expire_reflog(): move rewrite to flags argument

2014-12-04 Thread Michael Haggerty
The policy objects don't care about "--rewrite". So move it to
expire_reflog()'s flags parameter.

Signed-off-by: Michael Haggerty 
---
 builtin/reflog.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin/reflog.c b/builtin/reflog.c
index cc7a220..6294406 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -23,13 +23,13 @@ static unsigned long default_reflog_expire_unreachable;
 enum expire_reflog_flags {
EXPIRE_REFLOGS_DRY_RUN = 1 << 0,
EXPIRE_REFLOGS_UPDATE_REF = 1 << 1,
-   EXPIRE_REFLOGS_VERBOSE = 1 << 2
+   EXPIRE_REFLOGS_VERBOSE = 1 << 2,
+   EXPIRE_REFLOGS_REWRITE = 1 << 3
 };
 
 struct cmd_reflog_expire_cb {
struct rev_info revs;
int stalefix;
-   int rewrite;
unsigned long expire_total;
unsigned long expire_unreachable;
int recno;
@@ -337,7 +337,7 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned 
char *nsha1,
struct expire_reflog_cb *cb = cb_data;
struct expire_reflog_policy_cb *policy_cb = cb->policy_cb;
 
-   if (policy_cb->cmd->rewrite)
+   if (cb->flags & EXPIRE_REFLOGS_REWRITE)
osha1 = policy_cb->last_kept_sha1;
 
if (should_expire_reflog_ent(osha1, nsha1, email, timestamp, tz,
@@ -673,7 +673,7 @@ static int cmd_reflog_expire(int argc, const char **argv, 
const char *prefix)
else if (!strcmp(arg, "--stale-fix"))
cb.stalefix = 1;
else if (!strcmp(arg, "--rewrite"))
-   cb.rewrite = 1;
+   flags |= EXPIRE_REFLOGS_REWRITE;
else if (!strcmp(arg, "--updateref"))
flags |= EXPIRE_REFLOGS_UPDATE_REF;
else if (!strcmp(arg, "--all"))
@@ -755,7 +755,7 @@ static int cmd_reflog_delete(int argc, const char **argv, 
const char *prefix)
if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
flags |= EXPIRE_REFLOGS_DRY_RUN;
else if (!strcmp(arg, "--rewrite"))
-   cb.rewrite = 1;
+   flags |= EXPIRE_REFLOGS_REWRITE;
else if (!strcmp(arg, "--updateref"))
flags |= EXPIRE_REFLOGS_UPDATE_REF;
else if (!strcmp(arg, "--verbose"))
-- 
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