add check for unclean tree

This commit is contained in:
Joey Hess 2011-02-01 21:58:47 -04:00
parent c77ac11acc
commit 0e7984a793
4 changed files with 20 additions and 6 deletions

View file

@ -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