summaryrefslogtreecommitdiff
path: root/git-repack.sh
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2005-10-28 09:45:53 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-28 14:25:02 -0700
commit41f222e87a9062833712367d66114cae90b3769a (patch)
tree2558e290f84cfd0a5a324e8da0cfda2ac30ae0c1 /git-repack.sh
parent50b8e355b64c93a71d5008557e15f52c032240ff (diff)
downloadgit-41f222e87a9062833712367d66114cae90b3769a.tar.gz
Be marginally more careful about removing objects
The git philosophy when it comes to disk accesses is "Laugh in the face of danger". Notably, since we never modify an existing object, we don't really care that deeply about flushing things to disk, since even if the machine crashes in the middle of a git operation, you can never really have lost any old work. At most, you'd need to figure out the proper heads (which git-fsck-objects can do for you) and re-do the operation. However, there's two exceptions to this: pruning and repacking. Those operations will actually _delete_ old objects that they know about in other ways (ie that they just repacked, or that they have found in other places). However, since they actually modify old state, we should thus be a bit more careful about them. If the machine crashes and the duplicate new objects haven't been flushed to disk, you can actually be in trouble. This is trivially stupid about it by calling "sync" before removing the objects. Not very smart, but we're talking about special operations than are usually done once a week if that. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-repack.sh')
-rwxr-xr-xgit-repack.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/git-repack.sh b/git-repack.sh
index 49547a77c7..d341966efb 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -62,6 +62,7 @@ then
# all-into-one is used.
if test "$all_into_one" != '' && test "$existing" != ''
then
+ sync
( cd "$PACKDIR" &&
for e in $existing
do