Re: [PATCH v11 32/41] refs.c: make delete_ref use a transaction
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- May 30, 2014, 17:28 UTC
- Message-ID
- <20140530172808.GG12314@google.com>
- In-Reply-To
- <1401222360-21175-33-git-send-email-sahlberg@google.com>
Ronnie Sahlberg wrote:
> Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> > --- > refs.c | 34 +++++++++++++--------------------- > 1 file changed, 13 insertions(+), 21 deletions(-)
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
[...]
> +++ b/refs.c
[...]
> @@ -2542,24 +2537,21 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
>
> int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
> {[...]
Show 9 quoted lines
> + if (!transaction ||
> + ref_transaction_delete(transaction, refname, sha1, delopt,
> + sha1 && !is_null_sha1(sha1), &err) ||
> + ref_transaction_commit(transaction, NULL, &err)) {
> + error("%s", err.buf);
> + ref_transaction_free(transaction);
> + strbuf_release(&err);
> return 1;
> + }[...]
> - ret |= repack_without_ref(lock->ref_name);
The old return value could be 1 or -1 depending on how the deletion failed. Now it's consistently 1.
The only callers I see that care are cmd_symbolic_ref and cmd_update_ref, for which 1 is better (-1 would result in an exit status of 255, which means something like "died with signal 127").
Thanks, Jonathan