summaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-11 16:55:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-11 16:55:36 -0400
commite04852c8af22f784d184a001b9fee04adb1828c1 (patch)
tree025caa9f08d1c3ad0479bd14370851b0bef4afd3 /Command/Add.hs
parent730041688d616bff4df745c6605bbaff52733513 (diff)
parent81f311103d99ec5bfd31ae5a76d6add05ff40121 (diff)
Merge branch 'master' into new-monad-control
Conflicts: git-annex.cabal
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 9fdbdcaa6..9410601b8 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -29,13 +29,21 @@ seek = [withFilesNotInGit start, withFilesUnlocked start]
- moving it into the annex directory and setting up the symlink pointing
- to its content. -}
start :: BackendFile -> CommandStart
-start p@(_, file) = notBareRepo $ notAnnexed file $ do
- s <- liftIO $ getSymbolicLinkStatus file
- if isSymbolicLink s || not (isRegularFile s)
- then stop
- else do
+start p@(_, file) = notBareRepo $ ifAnnexed file fixup add
+ where
+ add = do
+ s <- liftIO $ getSymbolicLinkStatus file
+ if isSymbolicLink s || not (isRegularFile s)
+ then stop
+ else do
+ showStart "add" file
+ next $ perform p
+ fixup (key, _) = do
+ -- fixup from an interrupted add; the symlink
+ -- is present but not yet added to git
showStart "add" file
- next $ perform p
+ liftIO $ removeFile file
+ next $ next $ cleanup file key =<< inAnnex key
perform :: BackendFile -> CommandPerform
perform (backend, file) = Backend.genKey file backend >>= go