refs.c: change ref_transaction_update() to do error checking and return status
commit8e34800e5bce1dc6f1ab5520a4c866a2a73639de
authorRonnie Sahlberg <sahlberg@google.com>
Fri, 20 Jun 2014 14:43:00 +0000 (20 07:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jul 2014 18:54:42 +0000 (14 11:54 -0700)
treee868c5deecd615291d84ae6c3900dbf70b133876
parent01319837c53050109c60e6740dfa9462327161f0
refs.c: change ref_transaction_update() to do error checking and return status

Update ref_transaction_update() do some basic error checking and return
non-zero on error. Update all callers to check ref_transaction_update() for
error. There are currently no conditions in _update that will return error but
there will be in the future. Add an err argument that will be updated on
failure. In future patches we will start doing both locking and checking
for name conflicts in _update instead of _commit at which time this function
will start returning errors for these conditions.

Also check for BUGs during update and die(BUG:...) if we are calling
_update with have_old but the old_sha1 pointer is NULL.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
builtin/update-ref.c
refs.c
refs.h