Skip to content

Commit 3c9b01f

Browse files
mjgttaylorr
authored andcommitted
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 0f3c55d > # 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 0f3c55d > Tests pass unchanged after this code change. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent eea7033 commit 3c9b01f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/notes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void prepare_note_data(const struct object_id *object, struct note_data *
181181
strbuf_addch(&buf, '\n');
182182
strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
183183
strbuf_add_commented_lines(&buf, _(note_template), strlen(_(note_template)));
184-
strbuf_addch(&buf, '\n');
184+
strbuf_add_commented_lines(&buf, "\n", strlen("\n"));
185185
write_or_die(fd, buf.buf, buf.len);
186186

187187
write_commented_object(fd, object);

0 commit comments

Comments
 (0)