summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-03 13:39:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-03 13:39:07 -0400
commit9bce151df7b073c5f2507ea15ca2237814ae9248 (patch)
tree653751d0c0f70475fc1bd7e89d0465fa76b8c630 /Command
parente4fc1c290dba197a16c0e1cc0ff07ecfe2ee542b (diff)
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.
Diffstat (limited to 'Command')
-rw-r--r--Command/Direct.hs8
-rw-r--r--Command/Indirect.hs7
-rw-r--r--Command/Sync.hs23
-rw-r--r--Command/Unannex.hs12
-rw-r--r--Command/Uninit.hs4
5 files changed, 34 insertions, 20 deletions
diff --git a/Command/Direct.hs b/Command/Direct.hs
index d847a3270..1617bd9c2 100644
--- a/Command/Direct.hs
+++ b/Command/Direct.hs
@@ -30,8 +30,12 @@ perform :: CommandPerform
perform = do
showStart "commit" ""
showOutput
- _ <- inRepo $ Git.Command.runBool "commit"
- [Param "-a", Param "-m", Param "commit before switching to direct mode"]
+ _ <- inRepo $ Git.Command.runBool
+ [ Param "commit"
+ , Param "-a"
+ , Param "-m"
+ , Param "commit before switching to direct mode"
+ ]
showEndOk
top <- fromRepo Git.repoPath
diff --git a/Command/Indirect.hs b/Command/Indirect.hs
index 8bf228a80..6290e6756 100644
--- a/Command/Indirect.hs
+++ b/Command/Indirect.hs
@@ -43,8 +43,11 @@ perform = do
showStart "commit" ""
whenM (stageDirect) $ do
showOutput
- void $ inRepo $ Git.Command.runBool "commit"
- [Param "-m", Param "commit before switching to indirect mode"]
+ void $ inRepo $ Git.Command.runBool
+ [ Param "commit"
+ , Param "-m"
+ , Param "commit before switching to indirect mode"
+ ]
showEndOk
-- Note that we set indirect mode early, so that we can use
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
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index 0e691710a..d1f27e86a 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -34,7 +34,7 @@ cleanup :: FilePath -> Key -> CommandCleanup
cleanup file key = do
liftIO $ removeFile file
-- git rm deletes empty directory without --cached
- inRepo $ Git.Command.run "rm" [Params "--cached --quiet --", File file]
+ inRepo $ Git.Command.run [Params "rm --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
@@ -42,10 +42,12 @@ cleanup file key = do
-- git as a normal, non-annexed file.
(s, clean) <- inRepo $ LsFiles.staged [file]
when (not $ null s) $ do
- inRepo $ Git.Command.run "commit" [
- Param "-q",
- Params "-m", Param "content removed from git annex",
- Param "--", File file]
+ inRepo $ Git.Command.run
+ [ Param "commit"
+ , Param "-q"
+ , Param "-m", Param "content removed from git annex"
+ , Param "--", File file
+ ]
void $ liftIO clean
ifM (Annex.getState Annex.fast)
diff --git a/Command/Uninit.hs b/Command/Uninit.hs
index beb17394d..2ba32a2a6 100644
--- a/Command/Uninit.hs
+++ b/Command/Uninit.hs
@@ -67,6 +67,6 @@ start = next $ next $ do
liftIO $ removeDirectoryRecursive annexdir
-- avoid normal shutdown
saveState False
- inRepo $ Git.Command.run "branch"
- [Param "-D", Param $ show Annex.Branch.name]
+ inRepo $ Git.Command.run
+ [Param "branch", Param "-D", Param $ show Annex.Branch.name]
liftIO exitSuccess