Thread (16 messages) 16 messages, 3 authors, 2022-10-09
STALE1347d

[PATCH 4/6] sequencer: avoid empty lines after 'update-ref' instructions

From: SZEDER Gábor <hidden>
Date: 2022-09-30 14:10:38
Subsystem: the rest · Maintainer: Linus Torvalds

When the sequencer generates a todo list for 'git rebase
--update-refs', it always inserts an empty line after each
'update-ref' instruction and after each comment line about checked out
refs.  These empty lines are unnecessary, distracting, and waste
valuable vertical screen real estate, especially when multiple refs
point to the same commit:

  pick 29a79f8 two
  pick 74bf293 three
  # Ref refs/heads/branch3 checked out at '/tmp/test/WT'

  update-ref refs/heads/branch2

  update-ref refs/heads/branch1

  pick 5f59b82 four

Eliminate those empty lines.

Signed-off-by: SZEDER Gábor <redacted>
---
 sequencer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index d26ede83c4..fba92c90b1 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -5945,12 +5945,12 @@ static int add_decorations_to_list(const struct commit *commit,
 		/* If the branch is checked out, then leave a comment instead. */
 		if ((path = branch_checked_out(decoration->name))) {
 			item->command = TODO_COMMENT;
-			strbuf_addf(ctx->buf, "# Ref %s checked out at '%s'\n",
+			strbuf_addf(ctx->buf, "# Ref %s checked out at '%s'",
 				    decoration->name, path);
 		} else {
 			struct string_list_item *sti;
 			item->command = TODO_UPDATE_REF;
-			strbuf_addf(ctx->buf, "%s\n", decoration->name);
+			strbuf_addstr(ctx->buf, decoration->name);
 
 			sti = string_list_insert(&ctx->refs_to_oids,
 						 decoration->name);
-- 
2.38.0.rc2.542.g9b62912f7f
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help