Thread (7 messages) 7 messages, 2 authors, 2017-12-27

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

From: Liam Beguin <hidden>
Date: 2017-12-27 22:19:53

Hi Johannes,

On 23 December 2017 at 00:56, Johannes Schindelin
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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.
        }

        i = write_message(buf.buf, buf.len, todo_file, 0);
--
2.15.1.windows.2
Thanks,
Liam
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help