git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] refs.c: let fprintf handle the formatting
@ 2014-12-05 19:53 Stefan Beller
  2014-12-05 19:54 ` Stefan Beller
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Beller @ 2014-12-05 19:53 UTC (permalink / raw)
  To: git, mhagger, ronniesahlberg, gitster, jrnieder; +Cc: Stefan Beller

Instead of calculating, whether to put a plus or minus sign, offload
the responsibilty to the fprintf function.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 refs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/refs.c b/refs.c
index 40c5591..1147216 100644
--- a/refs.c
+++ b/refs.c
@@ -3972,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
 			printf("prune %s", message);
 	} else {
 		if (cb->newlog) {
-			char sign = (tz < 0) ? '-' : '+';
-			int zone = (tz < 0) ? (-tz) : tz;
-			fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s",
+			fprintf(cb->newlog, "%s %s %s %lu %+05d\t%s",
 				sha1_to_hex(osha1), sha1_to_hex(nsha1),
-				email, timestamp, sign, zone,
-				message);
+				email, timestamp, tz, message);
 			hashcpy(cb->last_kept_sha1, nsha1);
 		}
 		if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
-- 
2.2.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] refs.c: let fprintf handle the formatting
  2014-12-05 19:53 [PATCH] refs.c: let fprintf handle the formatting Stefan Beller
@ 2014-12-05 19:54 ` Stefan Beller
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Beller @ 2014-12-05 19:54 UTC (permalink / raw)
  To: git@vger.kernel.org, Michael Haggerty, ronnie sahlberg,
	Junio C Hamano, Jonathan Nieder
  Cc: Stefan Beller

On Fri, Dec 5, 2014 at 11:53 AM, Stefan Beller <sbeller@google.com> wrote:
> Instead of calculating, whether to put a plus or minus sign, offload
> the responsibilty to the fprintf function.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---

Ah! I forgot the --notes switch when sending out the email:

    Michael,

    please queue this on top of your reflog series.
    More to come.

    Thanks,
    Stefan




>  refs.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 40c5591..1147216 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -3972,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
>                         printf("prune %s", message);
>         } else {
>                 if (cb->newlog) {
> -                       char sign = (tz < 0) ? '-' : '+';
> -                       int zone = (tz < 0) ? (-tz) : tz;
> -                       fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s",
> +                       fprintf(cb->newlog, "%s %s %s %lu %+05d\t%s",
>                                 sha1_to_hex(osha1), sha1_to_hex(nsha1),
> -                               email, timestamp, sign, zone,
> -                               message);
> +                               email, timestamp, tz, message);
>                         hashcpy(cb->last_kept_sha1, nsha1);
>                 }
>                 if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
> --
> 2.2.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-05 19:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-05 19:53 [PATCH] refs.c: let fprintf handle the formatting Stefan Beller
2014-12-05 19:54 ` Stefan Beller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).