summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-02-01 21:58:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-02-01 22:02:19 -0400
commit0e7984a79354135f265d2342608953104d15db2e (patch)
tree6b8e59e6ca893cb05baff374c78accc4e284dfad /Command
parentc77ac11acc10efc23acfa3d81e1deaac11cb724f (diff)
add check for unclean tree
Diffstat (limited to 'Command')
-rw-r--r--Command/Unannex.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index 3810cca1c..c663b29ab 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -8,6 +8,7 @@
module Command.Unannex where
import Control.Monad.State (liftIO)
+import Control.Monad (unless)
import System.Directory
import Command
@@ -32,6 +33,11 @@ start file = isAnnexed file $ \(key, backend) -> do
ishere <- inAnnex key
if ishere
then do
+ g <- Annex.gitRepo
+ staged <- liftIO $ Git.stagedFiles g [Git.workTree g]
+ unless (null staged) $
+ error "This command cannot be run when there are already files staged for commit."
+
showStart "unannex" file
return $ Just $ perform file key backend
else return Nothing