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

Re: [PATCH 5/5] sequencer: do not invent whitespace when transforming OIDs

From
Liam Beguin <liambeguin@gmail.com>
Date
Dec 27, 2017, 22:19 UTC
Message-ID
<CAKm4OoX+S47iQnBogvU9j4k3pUBtn0uVWkjOKt-M+D6-O+4BzA@mail.gmail.com>
In-Reply-To
<da288dac49ac1e54db99349a50a7cd684956671c.1513986836.git.johannes.schindelin@gmx.de>
Hi Johannes,

On 23 December 2017 at 00:56, Johannes Schindelin <johannes.schindelin@gmx.de> wrote:

Show 21 quoted lines
> For commands that do not have an argument, there is no need to append a
> trailing space at the end of the line.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  sequencer.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 5632415ea2d..970842e3fcc 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -2584,7 +2584,10 @@ int transform_todos(unsigned flags)
>                         strbuf_addf(&buf, " %s", oid);
>                 }
>                 /* add all the rest */
> -               strbuf_addf(&buf, " %.*s\n", item->arg_len, item->arg);
> +               if (!item->arg_len)
> +                       strbuf_addch(&buf, '\n');
> +               else
> +                       strbuf_addf(&buf, " %.*s\n", item->arg_len, item->arg);

I also went with that when I was working on this but I thought leaving the extra whitespace would make the code a little shorter. Other than that, this change and the others look good.

Show 5 quoted lines
>         }
>
>         i = write_message(buf.buf, buf.len, todo_file, 0);
> --
> 2.15.1.windows.2

Thanks, Liam

Previous: Johannes SchindelinNext: Junio C Hamano
Message 7 of 8 in “A couple of sequencer cleanups”
  1. 0/5 A couple of sequencer cleanupsJohannes Schindelin, Dec 22, 2017
  2. 1/5 rebase: do not continue when the todo list generation failedJohannes Schindelin, Dec 22, 2017
  3. 2/5 sequencer: strip bogus LF at end of error messagesJohannes Schindelin, Dec 22, 2017
  4. 3/5 sequencer: remove superfluous conditionalJohannes Schindelin, Dec 22, 2017
  5. 4/5 sequencer: report when noop has an argumentJohannes Schindelin, Dec 22, 2017
  6. 5/5 sequencer: do not invent whitespace when transforming OIDsJohannes Schindelin, Dec 22, 2017
  7. Liam BeguinDec 27, 2017
  8. Junio C HamanoDec 27, 2017

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.