Re: [PATCH v11 32/41] refs.c: make delete_ref use a transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ronnie Sahlberg wrote:

> Signed-off-by: Ronnie Sahlberg <sahlberg@xxxxxxxxxx>
> ---
>  refs.c | 34 +++++++++++++---------------------
>  1 file changed, 13 insertions(+), 21 deletions(-)

Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

[...]
> +++ 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)
>  {
[...]
> +	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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]