git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] refs.c: let fprintf handle the formatting

From
Stefan Beller <sbeller@google.com>
Date
Dec 5, 2014, 19:54 UTC
Message-ID
<CAGZ79kbYDK0kJuwk+ksx3iB2cHzKvP54rCaH1o2Pknh-Axcfqw@mail.gmail.com>
In-Reply-To
<1417809221-27209-1-git-send-email-sbeller@google.com>
On Fri, Dec 5, 2014 at 11:53 AM, Stefan Beller <sbeller@google.com> wrote:
Show 5 quoted lines
> 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
Show 25 quoted lines
>  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
>
Previous: Stefan Beller
Message 2 of 2 in “refs.c: let fprintf handle the formatting”
  1. refs.c: let fprintf handle the formattingStefan Beller, Dec 5, 2014
  2. Stefan BellerDec 5, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.