Consolidate SHA1 object file close
commite9039dd35194b7c1cf4ecd479928638166b8458f
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Jun 2008 01:47:18 +0000 (10 18:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Jun 2008 05:23:18 +0000 (10 22:23 -0700)
tree546d1c2b4abc77de3b97eb0339afc33ea074ff6a
parentcdf222f5f0d6f2f22df12e83c4a1f9aae35f3084
Consolidate SHA1 object file close

This consolidates the common operations for closing the new temporary file
that we have written, before we move it into place with the final name.

There's some common code there (make it read-only and check for errors on
close), but more importantly, this also gives a single place to add an
fsync_or_die() call if we want to add a safe mode.

This was triggered due to Denis Bueno apparently twice being able to
corrupt his git repository on OS X due to an unlucky combination of kernel
crashes and a not-very-robust filesystem.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c