]> git.ipfire.org Git - thirdparty/git.git/commit
notes.c: append separator instead of insert by pos
authorTeng Long <dyroneteng@gmail.com>
Sat, 27 May 2023 07:57:52 +0000 (15:57 +0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Jun 2023 15:51:00 +0000 (08:51 -0700)
commitb7d87ad53707cb4d9b2c97dd8b5a145e095b6105
treed672b32c92946983d777e083e06ff7617a6ed4dd
parent90bc19b3aede4ebe8b1044541373ac970804cde4
notes.c: append separator instead of insert by pos

Rename "insert_separator" to "append_separator" and also remove the
"postion" argument, this serves two purpose:

The first is that when specifying more than one "-m" ( like "-F", etc)
to "git notes add" or "git notes append", the order of them matters,
which means we need to append the each separator and message in turn,
so we don't have to make the caller specify the position, the "append"
operation is enough and clear.

The second is that when we execute the "git notes append" subcommand,
we need to combine the "prev_note" and "current_note" to get the
final result. Before, we inserted a newline character at the beginning
of "current_note". Now, we will append a newline to the end of
"prev_note" instead, this will give the consisitent results.

Signed-off-by: Teng Long <dyroneteng@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c