path: root/builtin/checkout.c
diff options
authorJeff King <>2015-12-29 05:57:25 (GMT)
committerJunio C Hamano <>2015-12-29 18:34:25 (GMT)
commit396da8f7a07ae02a6152e0c0fc3eaac8a99b4c65 (patch)
treed05f7f3e507ade3fcbc1722e2f6af772d31ec498 /builtin/checkout.c
parent370e5ad65e8878989eecbae28a479b1a4d6a841b (diff)
create_symref: write reflog while holding lock
We generally hold a lock on the matching ref while writing to its reflog; this prevents two simultaneous writers from clobbering each other's reflog lines (it does not even have to be two symref updates; because we don't hold the lock, we could race with somebody writing to the pointed-to ref via HEAD, for example). We can fix this by writing the reflog before we commit the lockfile. This runs the risk of writing the reflog but failing the final rename(), but at least we now err on the same side as the rest of the ref code. Noticed-by: Michael Haggerty <> Signed-off-by: Jeff King <> Reviewed-by: Michael Haggerty <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/checkout.c')
0 files changed, 0 insertions, 0 deletions