diff options
author | Joey Hess <joey@kitenet.net> | 2010-12-28 17:44:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-12-28 17:44:55 -0400 |
commit | 1f20277ec7f23fa638422987d312f02f6ae1a5ee (patch) | |
tree | 7b8e1ece390a29c8029118aa3118779bb8012cee /Command/Untrust.hs | |
parent | 3714364905a23f3b64c6573a4121bd1cc5acb11e (diff) |
forgot to add these
Diffstat (limited to 'Command/Untrust.hs')
-rw-r--r-- | Command/Untrust.hs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Command/Untrust.hs b/Command/Untrust.hs new file mode 100644 index 000000000..5ed8de245 --- /dev/null +++ b/Command/Untrust.hs @@ -0,0 +1,40 @@ +{- git-annex command + - + - Copyright 2010 Joey Hess <joey@kitenet.net> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Command.Untrust where + +import Control.Monad.State (liftIO) +import Control.Monad (when) + +import Command +import qualified Annex +import qualified GitRepo as Git +import qualified Remotes +import UUID +import Messages + +seek :: [SubCmdSeek] +seek = [withString start] + +{- Marks a remote as not trusted. -} +start :: SubCmdStartString +start name = do + r <- Remotes.byName name + showStart "untrust" name + return $ Just $ perform r + +perform :: Git.Repo -> SubCmdPerform +perform repo = do + uuid <- getUUID repo + trusted <- getTrusted + when (elem uuid trusted) $ do + setTrusted $ filter (\u -> u /= uuid) trusted + g <- Annex.gitRepo + logfile <- trustLog + liftIO $ Git.run g ["add", logfile] + liftIO $ Git.run g ["commit", "-m", "git annex untrust", logfile] + return $ Just $ return True |