From: Ævar Arnfjörð Bjarmason Date: Thu, 12 Jan 2023 09:52:01 GMT Subject: Re: [PATCH v4 4/5] notes.c: provide tips when target and append note are both empty Message-ID: <230112.86358g2i6x.gmgdl@evledraar.gmail.com> In-Reply-To: On Thu, Jan 12 2023, Teng Long wrote: > From: Teng Long > > When "git notes append " is executed, if there is no note in > the given object and the appended note is empty too, we could print > the exact tips to end-user. > > Signed-off-by: Teng Long > --- > builtin/notes.c | 5 ++++- > t/t3301-notes.sh | 5 +++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/builtin/notes.c b/builtin/notes.c > index b71a81bff1..f2efb3736c 100644 > --- a/builtin/notes.c > +++ b/builtin/notes.c > @@ -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)); Style: This arm should have {}-braces too, see the CodingGuidelines.