Re: [PATCH 2/2] files_transaction_prepare(): fix handling of ref lock failure

2017-10-24 Thread Junio C Hamano
Michael Haggerty writes: > ... But dc39e09942 added another blurb of code between > the loop and the cleanup. That blurb sometimes resets `ret` to zero, > making the cleanup code think that the locking was successful. > ... > The fix is simple: instead of just breaking out of the loop, jump > dir

Re: [PATCH 2/2] files_transaction_prepare(): fix handling of ref lock failure

2017-10-24 Thread Jeff King
On Tue, Oct 24, 2017 at 05:16:25PM +0200, Michael Haggerty wrote: > The fix is simple: instead of just breaking out of the loop, jump > directly to the cleanup code. This fixes some tests in t1404 that were > added in the previous commit. Nicely explained. I think that fix makes sense, and match

[PATCH 2/2] files_transaction_prepare(): fix handling of ref lock failure

2017-10-24 Thread Michael Haggerty
Since dc39e09942 (files_ref_store: use a transaction to update packed refs, 2017-09-08), failure to lock a reference has been handled incorrectly by `files_transaction_prepare()`. If `lock_ref_for_update()` fails in the lock-acquisition loop of that function, it sets `ret` then breaks out of that l