bugfix: really run GitQueue against specified repo, not necessarily pwd

This commit is contained in:
Joey Hess 2010-10-31 15:25:55 -04:00
parent 96fa6b89ac
commit 435ec21d58
2 changed files with 7 additions and 6 deletions

View file

@ -23,8 +23,8 @@ import qualified GitRepo as Git
{- An action to perform in a git repository. The file to act on {- An action to perform in a git repository. The file to act on
- is not included, and must be able to be appended after the params. -} - is not included, and must be able to be appended after the params. -}
data Action = Action { data Action = Action {
subcommand :: String, getSubcommand :: String,
params :: [String] getParams :: [String]
} deriving (Show, Eq, Ord) } deriving (Show, Eq, Ord)
{- A queue of actions to perform (in any order) on a git repository, {- A queue of actions to perform (in any order) on a git repository,
@ -45,7 +45,7 @@ add queue subcommand params file = M.insertWith (++) action [file] queue
{- Runs a queue on a git repository. -} {- Runs a queue on a git repository. -}
run :: Git.Repo -> Queue -> IO () run :: Git.Repo -> Queue -> IO ()
run repo queue = do run repo queue = do
mapM (\(k, v) -> runAction repo k v) $ M.toList queue _ <- mapM (\(k, v) -> runAction repo k v) $ M.toList queue
return () return ()
{- Runs an Action on a list of files in a git repository. {- Runs an Action on a list of files in a git repository.
@ -55,7 +55,7 @@ runAction :: Git.Repo -> Action -> [FilePath] -> IO ()
runAction repo action files = do runAction repo action files = do
unless (null files) runxargs unless (null files) runxargs
where where
runxargs = pOpen WriteToPipe "xargs" runxargs = pOpen WriteToPipe "xargs" ("-0":gitcmd) feedxargs
(["-0", "git", subcommand action] ++ (params action)) gitcmd = ["git"] ++ Git.gitCommandLine repo
feedxargs ((getSubcommand action):(getParams action))
feedxargs h = hPutStr h $ join "\0" files feedxargs h = hPutStr h $ join "\0" files

View file

@ -25,6 +25,7 @@ module GitRepo (
configMap, configMap,
configRead, configRead,
configTrue, configTrue,
gitCommandLine,
run, run,
pipeRead, pipeRead,
hPipeRead, hPipeRead,