refs.c: update ref_transaction_delete to check for error and return status

Change ref_transaction_delete() to do basic error checking and return
non-zero on error. Update all callers to check the return for
ref_transaction_delete(). There are currently no conditions in _delete 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 <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ronnie Sahlberg
2014-04-16 15:27:45 -07:00
committed by Junio C Hamano
parent b416af5bcd
commit 8c8bdc0d35
3 changed files with 22 additions and 11 deletions

View File

@ -258,8 +258,9 @@ static const char *parse_cmd_delete(struct strbuf *input, const char *next)
if (*next != line_termination)
die("delete %s: extra input: %s", refname, next);
ref_transaction_delete(transaction, refname, old_sha1,
update_flags, have_old);
if (ref_transaction_delete(transaction, refname, old_sha1,
update_flags, have_old, &err))
die("%s", err.buf);
update_flags = 0;
free(refname);