{"thread":{"id":"38118","subject":"[PATCH] refs.c: let fprintf handle the formatting","startedAt":"2014-12-05T19:53:41Z","lastAt":"2014-12-05T19:54:58Z","messageCount":2,"participants":["Stefan Beller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"253181","messageId":"1417809221-27209-1-git-send-email-sbeller@google.com","threadId":"38118","inReplyTo":null,"subject":"[PATCH] refs.c: let fprintf handle the formatting","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2014-12-05T19:53:41Z","receivedAt":"2014-12-05T19:53:41Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Instead of calculating, whether to put a plus or minus sign, offload\nthe responsibilty to the fprintf function.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n refs.c | 7 ++-----\n 1 file changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/refs.c b/refs.c\nindex 40c5591..1147216 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -3972,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,\n \t\t\tprintf(\"prune %s\", message);\n \t} else {\n \t\tif (cb->newlog) {\n-\t\t\tchar sign = (tz < 0) ? '-' : '+';\n-\t\t\tint zone = (tz < 0) ? (-tz) : tz;\n-\t\t\tfprintf(cb->newlog, \"%s %s %s %lu %c%04d\\t%s\",\n+\t\t\tfprintf(cb->newlog, \"%s %s %s %lu %+05d\\t%s\",\n \t\t\t\tsha1_to_hex(osha1), sha1_to_hex(nsha1),\n-\t\t\t\temail, timestamp, sign, zone,\n-\t\t\t\tmessage);\n+\t\t\t\temail, timestamp, tz, message);\n \t\t\thashcpy(cb->last_kept_sha1, nsha1);\n \t\t}\n \t\tif (cb->flags & EXPIRE_REFLOGS_VERBOSE)\n-- \n2.2.0\n"},{"id":"253182","messageId":"CAGZ79kbYDK0kJuwk+ksx3iB2cHzKvP54rCaH1o2Pknh-Axcfqw@mail.gmail.com","threadId":"38118","inReplyTo":"1417809221-27209-1-git-send-email-sbeller@google.com","subject":"Re: [PATCH] refs.c: let fprintf handle the formatting","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2014-12-05T19:54:58Z","receivedAt":"2014-12-05T19:54:58Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Fri, Dec 5, 2014 at 11:53 AM, Stefan Beller <sbeller@google.com> wrote:\n> Instead of calculating, whether to put a plus or minus sign, offload\n> the responsibilty to the fprintf function.\n>\n> Signed-off-by: Stefan Beller <sbeller@google.com>\n> ---\n\nAh! I forgot the --notes switch when sending out the email:\n\n    Michael,\n\n    please queue this on top of your reflog series.\n    More to come.\n\n    Thanks,\n    Stefan\n\n\n\n\n>  refs.c | 7 ++-----\n>  1 file changed, 2 insertions(+), 5 deletions(-)\n>\n> diff --git a/refs.c b/refs.c\n> index 40c5591..1147216 100644\n> --- a/refs.c\n> +++ b/refs.c\n> @@ -3972,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,\n>                         printf(\"prune %s\", message);\n>         } else {\n>                 if (cb->newlog) {\n> -                       char sign = (tz < 0) ? '-' : '+';\n> -                       int zone = (tz < 0) ? (-tz) : tz;\n> -                       fprintf(cb->newlog, \"%s %s %s %lu %c%04d\\t%s\",\n> +                       fprintf(cb->newlog, \"%s %s %s %lu %+05d\\t%s\",\n>                                 sha1_to_hex(osha1), sha1_to_hex(nsha1),\n> -                               email, timestamp, sign, zone,\n> -                               message);\n> +                               email, timestamp, tz, message);\n>                         hashcpy(cb->last_kept_sha1, nsha1);\n>                 }\n>                 if (cb->flags & EXPIRE_REFLOGS_VERBOSE)\n> --\n> 2.2.0\n>\n"}]}