more OsPath conversion (639/749)
Sponsored-by: k0ld
This commit is contained in:
parent
a5d48edd94
commit
c74c75b352
28 changed files with 147 additions and 132 deletions
|
@ -52,11 +52,11 @@ checkIgnoreStop :: CheckIgnoreHandle -> IO ()
|
|||
checkIgnoreStop = void . tryIO . CoProcess.stop
|
||||
|
||||
{- Returns True if a file is ignored. -}
|
||||
checkIgnored :: CheckIgnoreHandle -> RawFilePath -> IO Bool
|
||||
checkIgnored :: CheckIgnoreHandle -> OsPath -> IO Bool
|
||||
checkIgnored h file = CoProcess.query h send (receive "")
|
||||
where
|
||||
send to = do
|
||||
B.hPutStr to $ file `B.snoc` 0
|
||||
B.hPutStr to $ fromOsPath file `B.snoc` 0
|
||||
hFlush to
|
||||
receive c from = do
|
||||
s <- hGetSomeString from 1024
|
||||
|
@ -68,4 +68,4 @@ checkIgnored h file = CoProcess.query h send (receive "")
|
|||
parse s = case segment (== '\0') s of
|
||||
(_source:_line:pattern:_pathname:_eol:[]) -> Just $ not $ null pattern
|
||||
_ -> Nothing
|
||||
eofError = ioError $ mkIOError userErrorType "git cat-file EOF" Nothing Nothing
|
||||
eofError = ioError $ mkIOError userErrorType "git check-ignore EOF" Nothing Nothing
|
||||
|
|
|
@ -130,7 +130,7 @@ longRunningFilterProcessHandshake =
|
|||
-- Delay capability is not implemented, so filter it out.
|
||||
filtercapabilities = filter (`elem` [Capability "smudge", Capability "clean"])
|
||||
|
||||
data FilterRequest = Smudge FilePath | Clean FilePath
|
||||
data FilterRequest = Smudge OsPath | Clean OsPath
|
||||
deriving (Show, Eq)
|
||||
|
||||
{- Waits for the next FilterRequest to be received. Does not read
|
||||
|
@ -143,8 +143,8 @@ getFilterRequest = do
|
|||
let cs = mapMaybe decodeConfigValue ps
|
||||
case (extractConfigValue cs "command", extractConfigValue cs "pathname") of
|
||||
(Just command, Just pathname)
|
||||
| command == "smudge" -> return $ Just $ Smudge pathname
|
||||
| command == "clean" -> return $ Just $ Clean pathname
|
||||
| command == "smudge" -> return $ Just $ Smudge $ toOsPath pathname
|
||||
| command == "clean" -> return $ Just $ Clean $ toOsPath pathname
|
||||
| otherwise -> return Nothing
|
||||
_ -> return Nothing
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
-}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Git.Quote (
|
||||
unquote,
|
||||
|
@ -71,6 +72,12 @@ instance Quoteable RawFilePath where
|
|||
|
||||
noquote = id
|
||||
|
||||
#ifdef WITH_OSPATH
|
||||
instance Quoteable OsPath where
|
||||
quote qp f = quote qp (fromOsPath f :: RawFilePath)
|
||||
noquote = fromOsPath
|
||||
#endif
|
||||
|
||||
-- Allows building up a string that contains paths, which will get quoted.
|
||||
-- With OverloadedStrings, strings are passed through without quoting.
|
||||
-- Eg: QuotedPath f <> ": not found"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue