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