diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-17 15:56:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-17 15:56:56 -0400 |
commit | 02bc092940bc2c167d86e4aedfde4cc742d34e0c (patch) | |
tree | 83a9a3398994cb0bafedc59a17c8c0ee163c4b94 | |
parent | d3af9d383a02a0c557b84b30f11267deae49e347 (diff) |
try working around windows xargs problem
-rw-r--r-- | Build/BundledPrograms.hs | 3 | ||||
-rw-r--r-- | Git/Queue.hs | 20 |
2 files changed, 17 insertions, 6 deletions
diff --git a/Build/BundledPrograms.hs b/Build/BundledPrograms.hs index 7ce3900c1..7100af503 100644 --- a/Build/BundledPrograms.hs +++ b/Build/BundledPrograms.hs @@ -24,7 +24,10 @@ bundledPrograms = catMaybes , Just "git" #endif , Just "cp" +#ifndef mingw32_HOST_OS + -- using xargs on windows led to problems, so it's not used there , Just "xargs" +#endif , Just "rsync" , Just "ssh" #ifndef mingw32_HOST_OS diff --git a/Git/Queue.hs b/Git/Queue.hs index b8e863658..9bb7f77d1 100644 --- a/Git/Queue.hs +++ b/Git/Queue.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP, BangPatterns #-} module Git.Queue ( Queue, @@ -26,7 +26,7 @@ import Common import Git import Git.Command import qualified Git.UpdateIndex - + {- Queable actions that can be performed in a git repository. -} data Action @@ -147,13 +147,21 @@ runAction :: Repo -> Action -> IO () runAction repo (UpdateIndexAction streamers) = -- list is stored in reverse order Git.UpdateIndex.streamUpdateIndex repo $ reverse streamers -runAction repo action@(CommandAction {}) = +runAction repo action@(CommandAction {}) = +#ifndef mingw32_HOST_OS withHandle StdinHandle createProcessSuccess p $ \h -> do fileEncoding h hPutStr h $ intercalate "\0" $ toCommand $ getFiles action hClose h +#else + -- Using xargs on Windows is problimatic, so just run the command + -- once per file (not as efficient.) + if null (getFiles action) + then void $ boolSystem "git" gitparams + else forM_ (getFiles action) $ \f -> + void $ boolSystem "git" (gitparams ++ [f]) +#endif where - p = (proc "xargs" params) { env = gitEnv repo } - params = "-0":"git":baseparams - baseparams = toCommand $ gitCommandLine + p = (proc "xargs" $ "-0":"git":toCommand gitparams) { env = gitEnv repo } + gitparams = gitCommandLine (Param (getSubcommand action):getParams action) repo |