convert from readFileStrict
This removes that function, using file-io readFile' instead. Had to deal with newline conversion, which readFileStrict does on Windows. In a few cases, that was pretty ugly to deal with. Sponsored-by: Kevin Mueller
This commit is contained in:
parent
de1af273e0
commit
6e27b0d4d1
19 changed files with 94 additions and 71 deletions
|
@ -19,6 +19,7 @@ import Utility.Directory.Create
|
|||
import Annex.Version
|
||||
import qualified Utility.FileIO as F
|
||||
|
||||
import qualified Data.ByteString as S
|
||||
import qualified System.FilePath.ByteString as P
|
||||
|
||||
configureSmudgeFilter :: Annex ()
|
||||
|
@ -45,11 +46,12 @@ configureSmudgeFilter = unlessM (fromRepo Git.repoIsLocalBare) $ do
|
|||
lfs <- readattr lf
|
||||
gfs <- readattr gf
|
||||
gittop <- Git.localGitDir <$> gitRepo
|
||||
liftIO $ unless ("filter=annex" `isInfixOf` (lfs ++ gfs)) $ do
|
||||
liftIO $ unless ("filter=annex" `S.isInfixOf` (lfs <> gfs)) $ do
|
||||
createDirectoryUnder [gittop] (P.takeDirectory lf)
|
||||
writeFile (fromRawFilePath lf) (lfs ++ "\n" ++ unlines stdattr)
|
||||
F.writeFile' (toOsPath lf) $
|
||||
linesFile' (lfs <> encodeBS ("\n" ++ unlines stdattr))
|
||||
where
|
||||
readattr = liftIO . catchDefaultIO "" . readFileStrict . fromRawFilePath
|
||||
readattr = liftIO . catchDefaultIO mempty . F.readFile' . toOsPath
|
||||
|
||||
configureSmudgeFilterProcess :: Annex ()
|
||||
configureSmudgeFilterProcess =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue