author | Junio C Hamano <gitster@pobox.com> | |
Tue, 10 Feb 2009 20:16:31 +0000 (12:16 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 12 Feb 2009 02:32:16 +0000 (18:32 -0800) | ||
commit | 3e6b1d0abcd58f0b2b106212ce0a0e07a6de342f | |
tree | fdb5a3792a17a0279889d9b589dab58fc351bc82 | tree | snapshot |
parent | 784f8affe4dfc8ceec93803d6c22b4b8467a4642 | commit | diff |
Make repack less likely to corrupt repository
Some platforms refuse to rename a file that is open. When repacking an
already packed repository without adding any new object, the resulting
pack will contain the same set of objects as an existing pack, and on such
platforms, a newly created packfile cannot replace the existing one.
The logic detected this issue but did not try hard enough to recover from
it. Especially because the files that needs renaming come in pairs, there
potentially are different failure modes that one can be renamed but the
others cannot. Asking manual recovery to end users were error prone.
This patch tries to make it more robust by first making sure all the
existing files that need to be renamed have been renamed before
continuing, and attempts to roll back if some failed to rename.
This is based on an initial patch by Robin Rosenberg.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Some platforms refuse to rename a file that is open. When repacking an
already packed repository without adding any new object, the resulting
pack will contain the same set of objects as an existing pack, and on such
platforms, a newly created packfile cannot replace the existing one.
The logic detected this issue but did not try hard enough to recover from
it. Especially because the files that needs renaming come in pairs, there
potentially are different failure modes that one can be renamed but the
others cannot. Asking manual recovery to end users were error prone.
This patch tries to make it more robust by first making sure all the
existing files that need to be renamed have been renamed before
continuing, and attempts to roll back if some failed to rename.
This is based on an initial patch by Robin Rosenberg.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-repack.sh | diff | blob | history |