small RawFilePath optimisation
This commit is contained in:
parent
83a3786851
commit
33a05a1a91
2 changed files with 7 additions and 6 deletions
|
@ -32,9 +32,10 @@ import Control.Monad
|
||||||
import Control.Monad.Free
|
import Control.Monad.Free
|
||||||
import Control.Monad.Free.TH
|
import Control.Monad.Free.TH
|
||||||
import Control.Monad.Catch
|
import Control.Monad.Catch
|
||||||
import System.FilePath
|
|
||||||
import System.Exit (ExitCode(..))
|
import System.Exit (ExitCode(..))
|
||||||
import System.IO
|
import System.IO
|
||||||
|
import qualified System.FilePath.ByteString as P
|
||||||
|
import qualified Data.ByteString as B
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
|
@ -179,11 +180,11 @@ instance Proto.Serializable ProtoAssociatedFile where
|
||||||
| isSpace c = "%"
|
| isSpace c = "%"
|
||||||
| otherwise = [c]
|
| otherwise = [c]
|
||||||
|
|
||||||
deserialize s = case fromRawFilePath $ fromInternalGitPath $ toRawFilePath $ deesc [] s of
|
deserialize s = case fromInternalGitPath $ toRawFilePath $ deesc [] s of
|
||||||
[] -> Just $ ProtoAssociatedFile $ AssociatedFile Nothing
|
|
||||||
f
|
f
|
||||||
| isRelative f -> Just $ ProtoAssociatedFile $
|
| B.null f -> Just $ ProtoAssociatedFile $ AssociatedFile Nothing
|
||||||
AssociatedFile $ Just $ toRawFilePath f
|
| P.isRelative f -> Just $ ProtoAssociatedFile $
|
||||||
|
AssociatedFile $ Just f
|
||||||
| otherwise -> Nothing
|
| otherwise -> Nothing
|
||||||
where
|
where
|
||||||
deesc b [] = reverse b
|
deesc b [] = reverse b
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{- System.Directory without its conflicting isSymbolicLink
|
{- System.Directory without its conflicting isSymbolicLink and getFileSize.
|
||||||
-
|
-
|
||||||
- Copyright 2016 Joey Hess <id@joeyh.name>
|
- Copyright 2016 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue