Re: [PATCH v4 15/27] fast-import.c: change update_branch to use ref transactions

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

 



Ronnie Sahlberg <sahlberg@xxxxxxxxxx> writes:

> +	transaction = ref_transaction_begin();
> +	if ((!transaction ||
> +	    ref_transaction_update(transaction, b->name, b->sha1, old_sha1,
> +				   0, 1)) ||
> +	    (ref_transaction_commit(transaction, msg, &err) &&
> +	     !(transaction = NULL))) {
> +		ref_transaction_rollback(transaction);
> +		return error("Unable to update branch %s: %s", b->name,
> +			     strbuf_detach(&err, NULL));
> +	}

The assigning of NULL to transaction and always returning true looks
very suspicious.

Also, if we couldn't get transaction what happens?  I think you
wanted to avoid passing NULL to rollback but at the same time I
suspect you wanted to fall into that "return error()" part, but
apparently you are failing to have that cake and eat it too, no?
--
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]