Re: [PATCH v4 4/5] notes.c: provide tips when target and append note are both empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 12 2023, 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 too, we could print
> the exact tips to end-user.
>
> Signed-off-by: Teng Long <dyroneteng@xxxxxxxxx>
> ---
>  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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux