summaryrefslogtreecommitdiff
path: root/Commands.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-16 22:49:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-16 22:49:09 -0400
commitc0b16e0a7306bacce96564d80911bbdb5a246847 (patch)
tree898085892efc80103055fe7395c2499790b49d74 /Commands.hs
parent96451ac392d42973f508da08d7c1197c83c659a6 (diff)
actually, unannex w/o commit can work
just have to git rm
Diffstat (limited to 'Commands.hs')
-rw-r--r--Commands.hs29
1 files changed, 14 insertions, 15 deletions
diff --git a/Commands.hs b/Commands.hs
index be0a8e37f..67b8fe8ad 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -122,26 +122,25 @@ addCmd file = inBackend file err $ do
{- Undo addCmd. -}
unannexCmd :: FilePath -> Annex ()
unannexCmd file = notinBackend file err $ \(key, backend) -> do
- nocommit <- Annex.flagIsSet NoCommit
- if (nocommit)
- then error "--nocommit cannot be used in unannex mode"
- else do
- Backend.removeKey backend key
- logStatus key ValueMissing
- g <- Annex.gitRepo
- let src = annexLocation g key
- liftIO $ moveout g src
+ Backend.removeKey backend key
+ logStatus key ValueMissing
+ g <- Annex.gitRepo
+ let src = annexLocation g key
+ moveout g src
where
err = error $ "not annexed " ++ file
moveout g src = do
- removeFile file
- Git.run g ["rm", file]
- Git.run g ["commit", "-m",
- ("git-annex unannexed " ++ file), file]
+ nocommit <- Annex.flagIsSet NoCommit
+ liftIO removeFile file
+ liftIO Git.run g ["rm", file]
+ if (not nocommit)
+ then liftIO Git.run g ["commit", "-m",
+ ("git-annex unannexed " ++ file), file]
+ else return ()
-- git rm deletes empty directories;
-- put them back
- createDirectoryIfMissing True (parentDir file)
- renameFile src file
+ liftIO createDirectoryIfMissing True (parentDir file)
+ liftIO renameFile src file
return ()
{- Gets an annexed file from one of the backends. -}