On Mon, Nov 07 2022, Teng Long wrote: > From: Teng Long <dyroneteng@xxxxxxxxx> > > When "git notes append <object>" is executed, if there is no note in > the given object and the appended note is empty, the command line > prompt will be as follows: > > "Removing note for object <object>" > > Actually, this tip is not that accurate, because there is no note in > the original <object>, and it also does no remove work on the notes > reference, so let's fix this and give the correct tip. > > Signed-off-by: Teng Long <dyroneteng@xxxxxxxxx> > --- > builtin/notes.c | 17 ++++++++++++++--- > t/t3301-notes.sh | 3 ++- > 2 files changed, 16 insertions(+), 4 deletions(-) > > diff --git a/builtin/notes.c b/builtin/notes.c > index f0fa337e8c..02b88e54d8 100644 > --- a/builtin/notes.c > +++ b/builtin/notes.c > @@ -567,9 +567,15 @@ static int append_edit(int argc, const char **argv, const char *prefix) > struct notes_tree *t; > struct object_id object, new_note; > const struct object_id *note; > - char *logmsg; > + char *logmsg = NULL; > const char * const *usage; > - struct note_data d = { 0, 0, NULL, STRBUF_INIT }; > + struct note_data d = { > + .given = 0, > + .use_editor = 0, > + .edit_path = NULL, Most of this is an unrelated "use designated init" cleanup, which is good, but let's do that in a different commit if we need it. And then you can drop all of these... > + .buf = STRBUF_INIT ...and only need to keep this one.