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.
This commit is contained in:
parent
3a783b4a3a
commit
0c13d3065e
20 changed files with 95 additions and 76 deletions
|
@ -77,9 +77,8 @@ makeSpecialRemote name remotetype config = do
|
|||
- remote at the location, returns its name. -}
|
||||
makeGitRemote :: String -> String -> Annex String
|
||||
makeGitRemote basename location = makeRemote basename location $ \name ->
|
||||
void $ inRepo $
|
||||
Git.Command.runBool "remote"
|
||||
[Param "add", Param name, Param location]
|
||||
void $ inRepo $ Git.Command.runBool
|
||||
[Param "remote", Param "add", Param name, Param location]
|
||||
|
||||
{- If there's not already a remote at the location, adds it using the
|
||||
- action, which is passed the name of the remote to make.
|
||||
|
|
|
@ -141,13 +141,13 @@ pushToRemotes now notifypushes remotes = do
|
|||
- uuid in them. While ugly, those branches are reserved for pushing by us,
|
||||
- and so our pushes will never conflict with other pushes. -}
|
||||
pushFallback :: UUID -> Git.Ref -> Remote -> Git.Repo -> IO Bool
|
||||
pushFallback u branch remote = Git.Command.runBool "push" params
|
||||
pushFallback u branch remote = Git.Command.runBool
|
||||
[ Param "push"
|
||||
, Param $ Remote.name remote
|
||||
, Param $ refspec Annex.Branch.name
|
||||
, Param $ refspec branch
|
||||
]
|
||||
where
|
||||
params =
|
||||
[ Param $ Remote.name remote
|
||||
, Param $ refspec Annex.Branch.name
|
||||
, Param $ refspec branch
|
||||
]
|
||||
{- Push to refs/synced/uuid/branch; this
|
||||
- avoids cluttering up the branch display. -}
|
||||
refspec b = concat
|
||||
|
@ -162,7 +162,7 @@ manualPull :: Maybe Git.Ref -> [Remote] -> Assistant ([Bool], Bool)
|
|||
manualPull currentbranch remotes = do
|
||||
g <- liftAnnex gitRepo
|
||||
results <- liftIO $ forM remotes $ \r ->
|
||||
Git.Command.runBool "fetch" [Param $ Remote.name r] g
|
||||
Git.Command.runBool [Param "fetch", Param $ Remote.name r] g
|
||||
haddiverged <- liftAnnex Annex.Branch.forceUpdate
|
||||
forM_ remotes $ \r ->
|
||||
liftAnnex $ Command.Sync.mergeRemote r currentbranch
|
||||
|
|
|
@ -81,9 +81,9 @@ commitStaged = do
|
|||
Left _ -> return False
|
||||
Right _ -> do
|
||||
direct <- isDirect
|
||||
let params = nomessage $
|
||||
catMaybes
|
||||
[ Just $ Param "--quiet"
|
||||
let params = nomessage $ catMaybes
|
||||
[ Just $ Param "commit"
|
||||
, Just $ Param "--quiet"
|
||||
{- In indirect mode, avoid running the
|
||||
- usual git-annex pre-commit hook;
|
||||
- watch does the same symlink fixing,
|
||||
|
@ -95,7 +95,7 @@ commitStaged = do
|
|||
- each other out, etc. Git returns nonzero on those,
|
||||
- so don't propigate out commit failures. -}
|
||||
void $ inRepo $ catchMaybeIO .
|
||||
Git.Command.runQuiet "commit" params
|
||||
Git.Command.runQuiet params
|
||||
return True
|
||||
where
|
||||
nomessage ps
|
||||
|
|
|
@ -76,10 +76,11 @@ setRepoConfig uuid mremote oldc newc = do
|
|||
let remotefetch = "remote." ++ T.unpack (repoName oldc) ++ ".fetch"
|
||||
needfetch <- isNothing <$> fromRepo (Git.Config.getMaybe remotefetch)
|
||||
when needfetch $
|
||||
inRepo $ Git.Command.run "config"
|
||||
[Param remotefetch, Param ""]
|
||||
inRepo $ Git.Command.run "remote"
|
||||
[ Param "rename"
|
||||
inRepo $ Git.Command.run
|
||||
[Param "config", Param remotefetch, Param ""]
|
||||
inRepo $ Git.Command.run
|
||||
[ Param "remote"
|
||||
, Param "rename"
|
||||
, Param $ T.unpack $ repoName oldc
|
||||
, Param name
|
||||
]
|
||||
|
|
|
@ -305,8 +305,9 @@ initRepo primary_assistant_repo dir desc = inDir dir $ do
|
|||
unlessM (Git.Config.isBare <$> gitRepo) $
|
||||
{- Initialize the master branch, so things that expect
|
||||
- to have it will work, before any files are added. -}
|
||||
void $ inRepo $ Git.Command.runBool "commit"
|
||||
[ Param "--quiet"
|
||||
void $ inRepo $ Git.Command.runBool
|
||||
[ Param "commit"
|
||||
, Param "--quiet"
|
||||
, Param "--allow-empty"
|
||||
, Param "-m"
|
||||
, Param "created repository"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue