summaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-02 13:13:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-02 15:02:00 -0400
commit56835693f551bdd07f6a840cce2d760098eebd82 (patch)
tree576a80009ea1cb6fe05f9a196f8421583457fcdf /Command/Add.hs
parent8ba1f8f3327288bba9e27081d1aa651adbaa1e3e (diff)
Update working tree files fully atomically
This avoids commit churn by the assistant when eg, replacing a file with a symlink. But, just as importantly, it prevents the working tree being left with a deleted file if git-annex, or perhaps the whole system, crashes at the wrong time. (It also probably avoids confusing displays in file managers.)
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index b90db8ba1..c15f3c51f 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -175,7 +175,7 @@ undo file key e = do
link :: FilePath -> Key -> Bool -> Annex String
link file key hascontent = handle (undo file key) $ do
l <- calcGitLink file key
- makeAnnexLink l file
+ replaceFile file $ makeAnnexLink l
#ifndef __ANDROID__
when hascontent $ do