From 899f84a217681833146fadd8f30cd25ed1a9f653 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 10 Jun 2014 19:20:14 -0400 Subject: export CreateProcess fields from Utility.Process update code to avoid cwd and env redefinition warnings --- Git/CheckAttr.hs | 10 +++++----- Git/Command.hs | 2 -- Git/Config.hs | 1 - Git/CurrentRepo.hs | 8 ++++---- Git/Fsck.hs | 1 - Git/LsFiles.hs | 4 ++-- Git/Queue.hs | 3 --- Git/UpdateIndex.hs | 1 - 8 files changed, 11 insertions(+), 19 deletions(-) (limited to 'Git') diff --git a/Git/CheckAttr.hs b/Git/CheckAttr.hs index 94ead5b4c..6b5e3bf62 100644 --- a/Git/CheckAttr.hs +++ b/Git/CheckAttr.hs @@ -23,9 +23,9 @@ type Attr = String - values and returns a handle. -} checkAttrStart :: [Attr] -> Repo -> IO CheckAttrHandle checkAttrStart attrs repo = do - cwd <- getCurrentDirectory + currdir <- getCurrentDirectory h <- CoProcess.rawMode =<< gitCoProcessStart True params repo - return (h, attrs, cwd) + return (h, attrs, currdir) where params = [ Param "check-attr" @@ -38,7 +38,7 @@ checkAttrStop (h, _, _) = CoProcess.stop h {- Gets an attribute of a file. -} checkAttr :: CheckAttrHandle -> Attr -> FilePath -> IO String -checkAttr (h, attrs, cwd) want file = do +checkAttr (h, attrs, currdir) want file = do pairs <- CoProcess.query h send (receive "") let vals = map snd $ filter (\(attr, _) -> attr == want) pairs case vals of @@ -83,8 +83,8 @@ checkAttr (h, attrs, cwd) want file = do - so use relative filenames. -} oldgit = Git.BuildVersion.older "1.7.7" file' - | oldgit = absPathFrom cwd file - | otherwise = relPathDirToFile cwd $ absPathFrom cwd file + | oldgit = absPathFrom currdir file + | otherwise = relPathDirToFile currdir $ absPathFrom currdir file oldattrvalue attr l = end bits !! 0 where bits = split sep l diff --git a/Git/Command.hs b/Git/Command.hs index a0c7c4b2a..39a3c6849 100644 --- a/Git/Command.hs +++ b/Git/Command.hs @@ -9,8 +9,6 @@ module Git.Command where -import System.Process (std_out, env) - import Common import Git import Git.Types diff --git a/Git/Config.hs b/Git/Config.hs index b5c1be04a..d998fd1e2 100644 --- a/Git/Config.hs +++ b/Git/Config.hs @@ -9,7 +9,6 @@ module Git.Config where import qualified Data.Map as M import Data.Char -import System.Process (cwd, env) import Control.Exception.Extensible import Common diff --git a/Git/CurrentRepo.hs b/Git/CurrentRepo.hs index ee91a6b81..23ebbbcad 100644 --- a/Git/CurrentRepo.hs +++ b/Git/CurrentRepo.hs @@ -37,8 +37,8 @@ get = do case wt of Nothing -> return r Just d -> do - cwd <- getCurrentDirectory - unless (d `dirContains` cwd) $ + curr <- getCurrentDirectory + unless (d `dirContains` curr) $ setCurrentDirectory d return $ addworktree wt r where @@ -57,8 +57,8 @@ get = do configure Nothing (Just r) = Git.Config.read r configure (Just d) _ = do absd <- absPath d - cwd <- getCurrentDirectory - r <- newFrom $ Local { gitdir = absd, worktree = Just cwd } + curr <- getCurrentDirectory + r <- newFrom $ Local { gitdir = absd, worktree = Just curr } Git.Config.read r configure Nothing Nothing = error "Not in a git repository." diff --git a/Git/Fsck.hs b/Git/Fsck.hs index 80f76dd90..c6002f681 100644 --- a/Git/Fsck.hs +++ b/Git/Fsck.hs @@ -23,7 +23,6 @@ import Utility.Batch import qualified Git.Version import qualified Data.Set as S -import System.Process (std_out, std_err) import Control.Concurrent.Async type MissingObjects = S.Set Sha diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs index e1558456f..2aa05ba7f 100644 --- a/Git/LsFiles.hs +++ b/Git/LsFiles.hs @@ -132,8 +132,8 @@ typeChanged' ps l repo = do -- git diff returns filenames relative to the top of the git repo; -- convert to filenames relative to the cwd, like git ls-files. let top = repoPath repo - cwd <- getCurrentDirectory - return (map (\f -> relPathDirToFile cwd $ top f) fs, cleanup) + currdir <- getCurrentDirectory + return (map (\f -> relPathDirToFile currdir $ top f) fs, cleanup) where prefix = [Params "diff --name-only --diff-filter=T -z"] suffix = Param "--" : (if null l then [File "."] else map File l) diff --git a/Git/Queue.hs b/Git/Queue.hs index 5f7b142c0..606a04157 100644 --- a/Git/Queue.hs +++ b/Git/Queue.hs @@ -24,9 +24,6 @@ import Git.Command import qualified Git.UpdateIndex import qualified Data.Map as M -#ifndef mingw32_HOST_OS -import System.Process -#endif {- Queable actions that can be performed in a git repository. -} diff --git a/Git/UpdateIndex.hs b/Git/UpdateIndex.hs index 4ecd77363..7de2f1be3 100644 --- a/Git/UpdateIndex.hs +++ b/Git/UpdateIndex.hs @@ -30,7 +30,6 @@ import Git.FilePath import Git.Sha import Control.Exception (bracket) -import System.Process (std_in) {- Streamers are passed a callback and should feed it lines in the form - read by update-index, and generated by ls-tree. -} -- cgit v1.2.3