export CreateProcess fields from Utility.Process
update code to avoid cwd and env redefinition warnings
This commit is contained in:
parent
6eb5e6c135
commit
a44fd2c019
31 changed files with 458 additions and 480 deletions
|
@ -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
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
module Git.Command where
|
||||
|
||||
import System.Process (std_out, env)
|
||||
|
||||
import Common
|
||||
import Git
|
||||
import Git.Types
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
-}
|
||||
|
|
|
@ -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. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue