]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: do not invent whitespace when transforming OIDs
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 22 Dec 2017 23:56:00 +0000 (00:56 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Dec 2017 20:33:38 +0000 (12:33 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c

index b005e412a5b04ba6bf2df31157d01bbbe779fd27..4d3f60594cbf0e9ddf2ea78e8c58eca312b4cac0 100644 (file)
@@ -2586,7 +2586,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 = write_message(buf.buf, buf.len, todo_file, 0);