Re: [PATCHv6 06/23] notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond

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

 



On Tue, Nov 9, 2010 at 7:49 PM, Johan Herland <johan@xxxxxxxxxxx> wrote:
> The combine_notes_fn functions uses a non-zero return value to indicate
> failure. However, this return value was converted to a call to die()
> in note_tree_insert().
>
> Instead, propagate this return value out to add_note(), and return it
> from there to enable the caller to handle errors appropriately.
>
> Existing add_note() callers are updated to die() upon failure, thus
> preserving the current behaviour. The only exceptions are copy_note()
> and notes_cache_put() where we are able to propagate the add_note()
> return value instead.
>
> This patch has been improved by the following contributions:
> - Jonathan Nieder: Future-proof by always checking add_note() return value
> - Jonathan Nieder: Improve clarity of final if-condition in note_tree_insert()
>
> Thanks-to: Jonathan Nieder <jrnieder@xxxxxxxxx>
> Signed-off-by: Johan Herland <johan@xxxxxxxxxxx>
> ---
> Âbuiltin/notes.c | Â 11 ++++++-----
> Ânotes-cache.c  |  Â3 +--
> Ânotes.c     |  55 ++++++++++++++++++++++++++++---------------------------
> Ânotes.h     |  11 ++++++++---
> Â4 files changed, 43 insertions(+), 37 deletions(-)
>
> diff --git a/builtin/notes.c b/builtin/notes.c
> index fbc347c..35f6eb6 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -573,8 +573,8 @@ static int add(int argc, const char **argv, const char *prefix)
>
> Â Â Â Âif (is_null_sha1(new_note))
> Â Â Â Â Â Â Â Âremove_note(t, object);
> - Â Â Â else
> - Â Â Â Â Â Â Â add_note(t, object, new_note, combine_notes_overwrite);
> + Â Â Â else if (add_note(t, object, new_note, combine_notes_overwrite))
> + Â Â Â Â Â Â Â die("confused: combine_notes_overwrite failed");

This message looks like more a debug information. Could it be
rewritten to be more user friendly / more informative?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]