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