From b416af5bcdca3ac8426220f09efbfca2f1bec6e0 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 16 Apr 2014 15:26:44 -0700 Subject: refs.c: change ref_transaction_create to do error checking and return status Do basic error checking in ref_transaction_create() and make it return non-zero on error. Update all callers to check the result of ref_transaction_create(). There are currently no conditions in _create that will return error but there will be in the future. Add an err argument that will be updated on failure. Signed-off-by: Ronnie Sahlberg Reviewed-by: Michael Haggerty Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- builtin/update-ref.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'builtin/update-ref.c') diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 3067b11310..41121fa37b 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -226,7 +226,9 @@ static const char *parse_cmd_create(struct strbuf *input, const char *next) if (*next != line_termination) die("create %s: extra input: %s", refname, next); - ref_transaction_create(transaction, refname, new_sha1, update_flags); + if (ref_transaction_create(transaction, refname, new_sha1, + update_flags, &err)) + die("%s", err.buf); update_flags = 0; free(refname); -- cgit v1.2.1