diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-14 15:56:11 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-14 15:56:11 -0400 |
commit | ef28b3fef7e236d8c27ce35308c0e37ece58d20c (patch) | |
tree | 346b40aaffcdb2ad5220741d9b9546821d07c4c9 /Command | |
parent | 02f1bd2bf47d3ff49a222e9428ec27708ef55f64 (diff) |
split out Git/Command.hs
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Sync.hs | 11 | ||||
-rw-r--r-- | Command/Unannex.hs | 6 | ||||
-rw-r--r-- | Command/Uninit.hs | 6 | ||||
-rw-r--r-- | Command/Unused.hs | 3 |
4 files changed, 15 insertions, 11 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs index 987eb6138..a25bcad8c 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -10,7 +10,7 @@ module Command.Sync where import Common.Annex import Command import qualified Annex.Branch -import qualified Git +import qualified Git.Command import qualified Git.Config import qualified Data.ByteString.Lazy.Char8 as L @@ -28,7 +28,8 @@ commit = do next $ next $ do showOutput -- Commit will fail when the tree is clean, so ignore failure. - _ <- inRepo $ Git.runBool "commit" [Param "-a", Param "-m", Param "sync"] + _ <- inRepo $ Git.Command.runBool "commit" + [Param "-a", Param "-m", Param "sync"] return True pull :: CommandStart @@ -38,7 +39,7 @@ pull = do next $ next $ do showOutput checkRemote remote - inRepo $ Git.runBool "pull" [Param remote] + inRepo $ Git.Command.runBool "pull" [Param remote] push :: CommandStart push = do @@ -47,7 +48,7 @@ push = do next $ next $ do Annex.Branch.update showOutput - inRepo $ Git.runBool "push" [Param remote, matchingbranches] + inRepo $ Git.Command.runBool "push" [Param remote, matchingbranches] where -- git push may be configured to not push matching -- branches; this should ensure it always does. @@ -61,7 +62,7 @@ defaultRemote = do currentBranch :: Annex String currentBranch = last . split "/" . L.unpack . head . L.lines <$> - inRepo (Git.pipeRead [Param "symbolic-ref", Param "HEAD"]) + inRepo (Git.Command.pipeRead [Param "symbolic-ref", Param "HEAD"]) checkRemote :: String -> Annex () checkRemote remote = do diff --git a/Command/Unannex.hs b/Command/Unannex.hs index bed857b06..8a511bf4d 100644 --- a/Command/Unannex.hs +++ b/Command/Unannex.hs @@ -13,7 +13,7 @@ import qualified Annex import Utility.FileMode import Logs.Location import Annex.Content -import qualified Git +import qualified Git.Command import qualified Git.LsFiles as LsFiles def :: [Command] @@ -34,14 +34,14 @@ cleanup :: FilePath -> Key -> CommandCleanup cleanup file key = do liftIO $ removeFile file -- git rm deletes empty directory without --cached - inRepo $ Git.run "rm" [Params "--cached --quiet --", File file] + inRepo $ Git.Command.run "rm" [Params "--cached --quiet --", File file] -- If the file was already committed, it is now staged for removal. -- Commit that removal now, to avoid later confusing the -- pre-commit hook if this file is later added back to -- git as a normal, non-annexed file. whenM (not . null <$> inRepo (LsFiles.staged [file])) $ do - inRepo $ Git.run "commit" [ + inRepo $ Git.Command.run "commit" [ Param "-m", Param "content removed from git annex", Param "--", File file] diff --git a/Command/Uninit.hs b/Command/Uninit.hs index 48f5b1ac1..fc6f0cc27 100644 --- a/Command/Uninit.hs +++ b/Command/Uninit.hs @@ -12,6 +12,7 @@ import qualified Data.ByteString.Lazy.Char8 as B import Common.Annex import Command import qualified Git +import qualified Git.Command import qualified Annex import qualified Command.Unannex import Init @@ -29,7 +30,7 @@ check = do "cannot uninit when the " ++ show b ++ " branch is checked out" where current_branch = Git.Ref . head . lines . B.unpack <$> revhead - revhead = inRepo $ Git.pipeRead + revhead = inRepo $ Git.Command.pipeRead [Params "rev-parse --abbrev-ref HEAD"] seek :: [CommandSeek] @@ -57,5 +58,6 @@ cleanup = do liftIO $ removeDirectoryRecursive annexdir -- avoid normal shutdown saveState - inRepo $ Git.run "branch" [Param "-D", Param $ show Annex.Branch.name] + inRepo $ Git.Command.run "branch" + [Param "-D", Param $ show Annex.Branch.name] liftIO exitSuccess diff --git a/Command/Unused.hs b/Command/Unused.hs index cd1cd1602..8a70ff335 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -20,6 +20,7 @@ import Utility.TempFile import Logs.Location import qualified Annex import qualified Git +import qualified Git.Command import qualified Git.Ref import qualified Git.LsFiles as LsFiles import qualified Git.LsTree as LsTree @@ -148,7 +149,7 @@ unusedKeys = do excludeReferenced :: [Key] -> Annex [Key] excludeReferenced [] = return [] -- optimisation excludeReferenced l = do - c <- inRepo $ Git.pipeRead [Param "show-ref"] + c <- inRepo $ Git.Command.pipeRead [Param "show-ref"] removewith (getKeysReferenced : map getKeysReferencedInGit (refs c)) (S.fromList l) where |