diff options
author | Teng Long <dyroneteng@gmail.com> | 2023-05-27 15:57:51 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-21 08:51:00 -0700 |
commit | 90bc19b3aede4ebe8b1044541373ac970804cde4 (patch) | |
tree | c85e4aa55e1c37a009d81fcd28ce3784cd2ddecc /builtin/commit-graph.c | |
parent | 59587049e2724d762c52f8c475e7ecd79dc96b18 (diff) |
notes.c: introduce '--separator=<paragraph-break>' option
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' and
'git notes append', 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.
Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit-graph.c')
0 files changed, 0 insertions, 0 deletions