diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-04-16 15:27:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-09-03 10:04:08 -0700 |
commit | 8c8bdc0d3582e42c13815a191344b1aa3e06c792 (patch) | |
tree | 8303c86ee46b8e76a2082f67fa275ec0149fde0e /refs.h | |
parent | b416af5bcdca3ac8426220f09efbfca2f1bec6e0 (diff) | |
download | git-8c8bdc0d3582e42c13815a191344b1aa3e06c792.tar.gz git-8c8bdc0d3582e42c13815a191344b1aa3e06c792.tar.xz |
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>
Diffstat (limited to 'refs.h')
-rw-r--r-- | refs.h | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -308,11 +308,15 @@ int ref_transaction_create(struct ref_transaction *transaction, * Add a reference deletion to transaction. If have_old is true, then * old_sha1 holds the value that the reference should have had before * the update (which must not be the null SHA-1). + * Function returns 0 on success and non-zero on failure. A failure to delete + * means that the transaction as a whole has failed and will need to be + * rolled back. */ -void ref_transaction_delete(struct ref_transaction *transaction, - const char *refname, - const unsigned char *old_sha1, - int flags, int have_old); +int ref_transaction_delete(struct ref_transaction *transaction, + const char *refname, + const unsigned char *old_sha1, + int flags, int have_old, + struct strbuf *err); /* * Commit all of the changes that have been queued in transaction, as |