From: Jeff King Date: Wed, 17 May 2017 13:19:58 GMT Subject: Re: [PATCH 11/23] files_transaction_cleanup(): new helper function Message-ID: <20170517131958.nxb5ol3wrtwyskss@sigill.intra.peff.net> In-Reply-To: On Wed, May 17, 2017 at 02:05:34PM +0200, Michael Haggerty wrote: > 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