diff options
author | David Disseldorp <ddiss@suse.de> | 2024-07-29 17:14:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-29 15:31:30 -0700 |
commit | 8b426c84f376657e1e10839f3f5dafd9ba99593d (patch) | |
tree | 4448823eabf18b01a060808ddf71a7ed15ef95c3 /builtin/commit.c | |
parent | 39bf06adf96da25b87c9aa7d35a32ef3683eb4a4 (diff) |
notes: do not trigger editor when adding an empty note
With "git notes add -C $blob", the given blob contents are to be made
into a note without involving an editor. But when "--allow-empty" is
given, the editor is invoked, which can cause problems for
non-interactive callers[1].
This behaviour started with 90bc19b3ae (notes.c: introduce
'--separator=<paragraph-break>' option, 2023-05-27), which changed
editor invocation logic to check for a zero length note_data buffer.
Restore the original behaviour of "git note" that takes the contents
given via the "-m", "-C", "-F" options without invoking an editor, by
checking for any prior parameter callbacks, indicated by a non-zero
note_data.msg_nr. Remove the now-unneeded note_data.given flag.
Add a test for this regression by checking whether GIT_EDITOR is
invoked alongside "git notes add -C $empty_blob --allow-empty"
[1] https://github.com/ddiss/icyci/issues/12
Signed-off-by: David Disseldorp <ddiss@suse.de>
[jc: enhanced the test with -m/-F options]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
0 files changed, 0 insertions, 0 deletions