notes: avoid empty line in template
When `git notes` prepares the template it adds an empty newline between the comment header and the content: > > # > # Write/edit the notes for the following object: > > # commit 0f3c55d4c2b7864bffb2d92278eff08d0b2e083f > # etc This is wrong structurally because that newline is part of the comment, too, and thus should be commented. Also, it throws off some positioning strategies of editors and plugins, and it differs from how we do commit templates. Change this to follow the standard set by `git commit`: > > # > # Write/edit the notes for the following object: > # > # commit 0f3c55d4c2b7864bffb2d92278eff08d0b2e083f > Tests pass unchanged after this code change. Signed-off-by: Michael J Gruber <git@grubix.eu> Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
parent
eea7033409
commit
3c9b01f0bf
@ -181,7 +181,7 @@ static void prepare_note_data(const struct object_id *object, struct note_data *
|
||||
strbuf_addch(&buf, '\n');
|
||||
strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
|
||||
strbuf_add_commented_lines(&buf, _(note_template), strlen(_(note_template)));
|
||||
strbuf_addch(&buf, '\n');
|
||||
strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
|
||||
write_or_die(fd, buf.buf, buf.len);
|
||||
|
||||
write_commented_object(fd, object);
|
||||
|
Loading…
Reference in New Issue
Block a user