@@ -631,7 +631,10 @@ static int append_edit(int argc, const char **argv, const char *prefix)
BUG("combine_notes_overwrite failed");
logmsg = xstrfmt("Notes added by 'git notes %s'", argv[0]);
commit_notes(the_repository, t, logmsg);
- }
+ } else if (!d.buf.len && !note)
+ fprintf(stderr,
+ _("Both original and appended notes are empty in %s, do nothing\n"),
+ oid_to_hex(&object));
free(logmsg);
free_note_data(&d);
@@ -552,6 +552,7 @@ test_expect_success 'appending empty string does not change existing note' '
'
test_expect_success 'git notes append == add when there is no existing note' '
+ test_when_finished git notes remove HEAD &&
git notes remove HEAD &&
test_must_fail git notes list HEAD &&
git notes append -m "Initial set of notes${LF}${LF}More notes appended with git notes append" &&
@@ -560,9 +561,9 @@ test_expect_success 'git notes append == add when there is no existing note' '
'
test_expect_success 'appending empty string to non-existing note does not create note' '
- git notes remove HEAD &&
test_must_fail git notes list HEAD &&
- git notes append -m "" &&
+ git notes append -m "" >output 2>&1 &&
+ grep "Both original and appended notes are empty" output &&
test_must_fail git notes list HEAD
'