lockfile: do not rollback lock on failed close
commit83a3069a3895de81fea720ffa6a3e47f9400fe04
authorJeff King <peff@peff.net>
Tue, 5 Sep 2017 12:14:33 +0000 (5 08:14 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Sep 2017 08:19:53 +0000 (6 17:19 +0900)
tree4d07619006dd562db5f666386f019a6e4103c3ef
parent49bd0fc2220eef17d8f5fd3ee76e391d03df8a6d
lockfile: do not rollback lock on failed close

Since the lockfile code is based on the tempfile code, it
has some of the same problems, including that close_lock_file()
erases the tempfile's filename buf, making it hard for the
caller to write a good error message.

In practice this comes up less for lockfiles than for
straight tempfiles, since we usually just report the
refname. But there is at least one buggy case in
write_ref_to_lockfile(). Besides, given the coupling between
the lockfile and tempfile modules, it's less confusing if
their close() functions have the same semantics.

Just as the previous commit did for close_tempfile(), let's
teach close_lock_file() and its wrapper close_ref() not to
rollback on error. And just as before, we'll give them new
"gently" names to catch any new callers that are added.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lockfile.h
read-cache.c
refs/files-backend.c
refs/packed-backend.c