summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeng Long <dyroneteng@gmail.com>2022-11-09 17:06:54 +0800
committerTaylor Blau <me@ttaylorr.com>2022-11-09 21:43:16 -0500
commit8f4921a70d8307cf2a46b35d6040f552420d75b9 (patch)
tree6179d8ba29acf420b904b056210176ff9268d0a0
parentd8d795a5d3448a9a97f680c83834b9592b50dee1 (diff)
downloadgit-8f4921a70d8307cf2a46b35d6040f552420d75b9.tar.gz
notes.c: drop unreachable code in 'append_edit()'
Situation of note "removing" shouldn't happen in 'append_edit()', unless it's a bug. So, let's drop the unreachable "else" code in "append_edit()". The notes operation "append" is different with "add", the latter supports to overwrite the existing note then let the "removing" happen (e.g. execute `git notes add -f -F /dev/null` on an existing note), but the former will not because it only does "appends" but not doing "overwrites". Signed-off-by: Teng Long <dyroneteng@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
-rw-r--r--builtin/notes.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 485439c901..8c3a1cd913 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -630,13 +630,8 @@ static int append_edit(int argc, const char **argv, const char *prefix)
if (add_note(t, &object, &new_note, combine_notes_overwrite))
BUG("combine_notes_overwrite failed");
logmsg = xstrfmt("Notes added by 'git notes %s'", argv[0]);
- } else {
- fprintf(stderr, _("Removing note for object %s\n"),
- oid_to_hex(&object));
- remove_note(t, object.hash);
- logmsg = xstrfmt("Notes removed by 'git notes %s'", argv[0]);
+ commit_notes(the_repository, t, logmsg);
}
- commit_notes(the_repository, t, logmsg);
free(logmsg);
free_note_data(&d);