From 9bce151df7b073c5f2507ea15ca2237814ae9248 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 3 Mar 2013 13:39:07 -0400 Subject: git subcommand cleanup Pass subcommand as a regular param, which allows passing git parameters like -c before it. This was already done in the pipeing set of functions, but not the command running set. --- Command/Sync.hs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'Command/Sync.hs') diff --git a/Command/Sync.hs b/Command/Sync.hs index cd0398ffa..39eda90f7 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -91,7 +91,7 @@ commit = next $ next $ do showOutput Annex.Branch.commit "update" -- Commit will fail when the tree is clean, so ignore failure. - _ <- inRepo $ Git.Command.runBool "commit" $ ps ++ + _ <- inRepo $ Git.Command.runBool $ (Param "commit") : ps ++ [Param "-m", Param "git-annex automatic sync"] return True @@ -117,8 +117,9 @@ updateBranch :: Git.Ref -> Git.Repo -> IO () updateBranch syncbranch g = unlessM go $ error $ "failed to update " ++ show syncbranch where - go = Git.Command.runBool "branch" - [ Param "-f" + go = Git.Command.runBool + [ Param "branch" + , Param "-f" , Param $ show $ Git.Ref.base syncbranch ] g @@ -130,8 +131,8 @@ pullRemote remote branch = do stopUnless fetch $ next $ mergeRemote remote (Just branch) where - fetch = inRepo $ Git.Command.runBool "fetch" - [Param $ Remote.name remote] + fetch = inRepo $ Git.Command.runBool + [Param "fetch", Param $ Remote.name remote] {- The remote probably has both a master and a synced/master branch. - Which to merge from? Well, the master has whatever latest changes @@ -162,8 +163,9 @@ pushRemote remote branch = go =<< needpush pushBranch :: Remote -> Git.Ref -> Git.Repo -> IO Bool pushBranch remote branch g = - Git.Command.runBool "push" - [ Param $ Remote.name remote + Git.Command.runBool + [ Param "push" + , Param $ Remote.name remote , Param $ refspec Annex.Branch.name , Param $ refspec branch ] g @@ -233,8 +235,11 @@ resolveMerge = do when merged $ do Annex.Queue.flush - void $ inRepo $ Git.Command.runBool "commit" - [Param "-m", Param "git-annex automatic merge conflict fix"] + void $ inRepo $ Git.Command.runBool + [ Param "commit" + , Param "-m" + , Param "git-annex automatic merge conflict fix" + ] return merged resolveMerge' :: LsFiles.Unmerged -> Annex Bool -- cgit v1.2.3