From 3d3a578e2e471437f3b0c893f207e863f3749374 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 1 Nov 2016 14:03:55 -0400 Subject: restart coprocess in raw mode Restarting a crashing git process could result in filename encoding issues when not in a unicode locale, as the restarted processes's handles were not read in raw mode. Since rawMode is always used when starting a coprocess, didn't bother to parameterise it and just always enable it for simplicity. This commit was sponsored by Jake Vosloo on Patreon. --- Git/CatFile.hs | 2 +- Git/CheckAttr.hs | 2 +- Git/CheckIgnore.hs | 2 +- Git/HashObject.hs | 2 +- Git/Tree.hs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'Git') diff --git a/Git/CatFile.hs b/Git/CatFile.hs index 9af46fb51..061349f05 100644 --- a/Git/CatFile.hs +++ b/Git/CatFile.hs @@ -51,7 +51,7 @@ catFileStart' restartable repo = CatFileHandle <$> startp "--batch" <*> startp "--batch-check=%(objectname) %(objecttype) %(objectsize)" where - startp p = CoProcess.rawMode =<< gitCoProcessStart restartable + startp p = gitCoProcessStart restartable [ Param "cat-file" , Param p ] repo diff --git a/Git/CheckAttr.hs b/Git/CheckAttr.hs index b94bc0ee1..a248f4982 100644 --- a/Git/CheckAttr.hs +++ b/Git/CheckAttr.hs @@ -24,7 +24,7 @@ type Attr = String checkAttrStart :: [Attr] -> Repo -> IO CheckAttrHandle checkAttrStart attrs repo = do currdir <- getCurrentDirectory - h <- CoProcess.rawMode =<< gitCoProcessStart True params repo + h <- gitCoProcessStart True params repo oldgit <- Git.Version.older "1.7.7" return (h, attrs, oldgit, currdir) where diff --git a/Git/CheckIgnore.hs b/Git/CheckIgnore.hs index 7d30e5ada..594882a81 100644 --- a/Git/CheckIgnore.hs +++ b/Git/CheckIgnore.hs @@ -37,7 +37,7 @@ type CheckIgnoreHandle = CoProcess.CoProcessHandle -} checkIgnoreStart :: Repo -> IO (Maybe CheckIgnoreHandle) checkIgnoreStart repo = ifM supportedGitVersion - ( Just <$> (CoProcess.rawMode =<< gitCoProcessStart True params repo') + ( Just <$> gitCoProcessStart True params repo' , return Nothing ) where diff --git a/Git/HashObject.hs b/Git/HashObject.hs index ed3baf4c6..4cd54ef54 100644 --- a/Git/HashObject.hs +++ b/Git/HashObject.hs @@ -20,7 +20,7 @@ import Utility.Tmp type HashObjectHandle = CoProcess.CoProcessHandle hashObjectStart :: Repo -> IO HashObjectHandle -hashObjectStart = CoProcess.rawMode <=< gitCoProcessStart True +hashObjectStart = gitCoProcessStart True [ Param "hash-object" , Param "-w" , Param "--stdin-paths" diff --git a/Git/Tree.hs b/Git/Tree.hs index c341e1f5b..282643f49 100644 --- a/Git/Tree.hs +++ b/Git/Tree.hs @@ -59,7 +59,7 @@ newtype MkTreeHandle = MkTreeHandle CoProcess.CoProcessHandle withMkTreeHandle :: (MonadIO m, MonadMask m) => Repo -> (MkTreeHandle -> m a) -> m a withMkTreeHandle repo a = bracketIO setup cleanup (a . MkTreeHandle) where - setup = CoProcess.rawMode =<< gitCoProcessStart False ps repo + setup = gitCoProcessStart False ps repo ps = [Param "mktree", Param "--batch", Param "-z"] cleanup = CoProcess.stop -- cgit v1.2.3