Re: [PATCH 11/23] files_transaction_cleanup(): new helper function
- From
Jeff King <peff@peff.net>
- Date
- May 17, 2017, 13:19 UTC
- Message-ID
- <20170517131958.nxb5ol3wrtwyskss@sigill.intra.peff.net>
- In-Reply-To
- <d6374d948f4424e4e6b4d999460597d226028be0.1495014840.git.mhagger@alum.mit.edu>
On Wed, May 17, 2017 at 02:05:34PM +0200, Michael Haggerty wrote:
Show 13 quoted lines
> Extract function from `files_transaction_commit()`. It will soon have
> another caller.
> [...]
> @@ -2868,10 +2889,8 @@ static int files_transaction_commit(struct ref_store *ref_store,
> if (transaction->state != REF_TRANSACTION_OPEN)
> die("BUG: commit called for transaction that is not open");
>
> - if (!transaction->nr) {
> - transaction->state = REF_TRANSACTION_CLOSED;
> - return 0;
> - }
> + if (!transaction->nr)
> + goto cleanup;This is slightly more than it says on the tin. I guess the reason is that the cleanup function is going to learn about more than just iterating over the transaction, and we'll want to trigger it even for empty transactions.
-Peff