git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fmt-merge-message: add empty line between tag and signature verification
@ 2012-05-25 16:02 Linus Torvalds
  2012-05-25 17:05 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2012-05-25 16:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List


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 <torvalds@linux-foundation.org>
---
This is a throw-away patch - apply or not as you prefer. I thought I'd 
send it out and see what people thought.

I don't feel *that* strongly about it.

Btw, I'd also like to see the merge notes (notably the conflict file list) 
before the generated shortlog, but that seems to really not work with the 
current fmt-merge-message model.  Oh well.

And the strbuf_complete_line() change is entirely independent, but didn't 
seem worth an extra separate patch.  Feel free to take that out, or do it 
independently or whatever.

 builtin/fmt-merge-msg.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index a517f1794a1c..d42015d8672d 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -462,7 +462,10 @@ static void fmt_tag_signature(struct strbuf *tagbuf,
 		strbuf_add(tagbuf, tag_body, buf + len - tag_body);
 	}
 	strbuf_complete_line(tagbuf);
-	strbuf_add_lines(tagbuf, "# ", sig->buf, sig->len);
+	if (sig->len) {
+		strbuf_addch(tagbuf, '\n');
+		strbuf_add_lines(tagbuf, "# ", sig->buf, sig->len);
+	}
 }
 
 static void fmt_merge_msg_sigs(struct strbuf *out)
@@ -627,8 +630,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
 		rev.ignore_merges = 1;
 		rev.limited = 1;
 
-		if (suffixcmp(out->buf, "\n"))
-			strbuf_addch(out, '\n');
+		strbuf_complete_line(out);
 
 		for (i = 0; i < origins.nr; i++)
 			shortlog(origins.items[i].string,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-25 18:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-25 16:02 fmt-merge-message: add empty line between tag and signature verification Linus Torvalds
2012-05-25 17:05 ` Junio C Hamano
2012-05-25 17:20   ` Linus Torvalds
2012-05-25 18:06     ` Martin Fick
2012-05-25 18:35   ` Ralf Thielow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).