Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit a3347b9

Browse files
torvaldsgitster
authored andcommitted
fmt-merge-message: add empty line between tag and signature verification
When adding the information from a tag, put an empty line between the message of the tag and the commented-out signature verification information. At least for the kernel workflow, I often end up re-formatting the message that people send me in the tag data. In that situation, putting the tag message and the tag signature verification back-to-back then means that normal editor "reflow parapgraph" command will get confused and think that the signature is a continuation of the last message paragraph. So I always end up having to first add an empty line, and then go back and reflow the last paragraph. Let's just do it in git directly. The extra vertical space also makes the verification visually stand out more from the user-supplied message, so it looks a bit more readable to me too, but that may be just an odd personal preference. Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ec84e06 commit a3347b9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

builtin/fmt-merge-msg.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ static void fmt_tag_signature(struct strbuf *tagbuf,
356356
strbuf_add(tagbuf, tag_body, buf + len - tag_body);
357357
}
358358
strbuf_complete_line(tagbuf);
359-
strbuf_add_lines(tagbuf, "# ", sig->buf, sig->len);
359+
if (sig->len) {
360+
strbuf_addch(tagbuf, '\n');
361+
strbuf_add_lines(tagbuf, "# ", sig->buf, sig->len);
362+
}
360363
}
361364

362365
static void fmt_merge_msg_sigs(struct strbuf *out)
@@ -521,8 +524,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
521524
rev.ignore_merges = 1;
522525
rev.limited = 1;
523526

524-
if (suffixcmp(out->buf, "\n"))
525-
strbuf_addch(out, '\n');
527+
strbuf_complete_line(out);
526528

527529
for (i = 0; i < origins.nr; i++)
528530
shortlog(origins.items[i].string,

0 commit comments

Comments
 (0)