]> git.ipfire.org Git - thirdparty/git.git/commit
t1404: demonstrate two problems with reference transactions
authorMichael Haggerty <mhagger@alum.mit.edu>
Fri, 8 Sep 2017 13:51:50 +0000 (15:51 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Sep 2017 18:18:04 +0000 (03:18 +0900)
commit6a2a7736d867dac39f2c54833fd0a65107c7cc5b
treeb69fae752807ff8bed34dfdaf85d4f4126ef1339
parent1444bfe0271a1dd46283a298e1a43c6565c38271
t1404: demonstrate two problems with reference transactions

Currently, a loose reference is deleted even before locking the
`packed-refs` file, let alone deleting any packed version of the
reference. This leads to two problems, demonstrated by two new tests:

* While a reference is being deleted, other processes might see the
  old, packed value of the reference for a moment before the packed
  version is deleted. Normally this would be hard to observe, but we
  can prolong the window by locking the `packed-refs` file externally
  before running `update-ref`, then unlocking it before `update-ref`'s
  attempt to acquire the lock times out.

* If the `packed-refs` file is locked so long that `update-ref` fails
  to lock it, then the reference can be left permanently in the
  incorrect state described in the previous point.

In a moment, both problems will be fixed.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1404-update-ref-errors.sh