TLDR; use git notes add -m foo -m bar --no-separator
Or:
git notes append --no-separator -m "Next line"
git notes append --no-separator -m "Another line"
You can see the separator illustrated with Git 2.42 (Q3 2023): 'git notes append
'(man) was taught '--separator
' to specify a string to insert between paragraphs.
See commit 3d6a316, commit c4e2aa7, commit b7d87ad, commit 90bc19b, commit 5958704, commit 3d27ae0, commit ef48fcc (27 May 2023) by Teng Long (dyrone
).
(Merged by Junio C Hamano -- gitster
-- in commit a9cc3b8, 06 Jul 2023)
notes.c
: introduce '--separator=' option
Signed-off-by: Teng Long
When adding new notes or appending to an existing notes, we will insert a blank line between the paragraphs, like:
$ git notes add -m foo -m bar
$ git notes show HEAD
foo
bar
The default behavour sometimes is not enough, the user may want to use a custom delimiter between paragraphs, like when specifying '-m', '-F', '-C', '-c' options.
So this commit introduce a new '--separator' option for 'git notes add
'(man) and 'git notes append
'(man), for example when executing:
$ git notes add -m foo -m bar --separator="-"
$ git notes show HEAD
foo
-
bar
a newline is added to the value given to --separator
if it does not end with one already.
So when executing:
$ git notes add -m foo -m bar --separator="-"
and
$ export LF="
"
$ git notes add -m foo -m bar --separator="-$LF"
Both the two exections produce the same result.
The reason we use a "strbuf" array to concat but not "string_list",
is that the binary file content may contain '\0' in the middle, this will cause the corrupt result if using a string to save.
git notes
now includes in its man page:
Append new message(s) given by -m
or -F
options to an
existing note, or add them as a new note if one does not
exist, for the object (defaults to HEAD). When appending to
an existing note, a blank line is added before each new
message as an inter-paragraph separator. The separator can
be customized with the --separator
option.
git notes
now includes in its man page:
--separator <paragraph-break>
Specify a string used as a custom inter-paragraph separator
(a newline is added at the end as needed). Defaults to a
blank line.
But now:
notes
: introduce "--no-separator" option
Signed-off-by: Teng Long
Sometimes, the user may want to add or append multiple notes without any separator to be added between them.
Disscussion:
https://public-inbox.org/git/3f86a553-246a-4626-b1bd-bacd8148318a@app.fastmail.com/
git notes
now includes in its man page:
--[no-]separator, --separator=<paragraph-break>
git notes
now includes in its man page:
If --no-separator
, no
separators will be added between paragraphs.
Defaults to a blank
line.