more OsPath conversion

Sponsored-by: Nicholas Golder-Manning
This commit is contained in:
Joey Hess 2025-01-29 11:53:20 -04:00
parent 0376bc5ee0
commit 27305042f3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
24 changed files with 180 additions and 153 deletions

View file

@ -61,7 +61,7 @@ cleanCorruptObjects fsckresults r = do
removeLoose s = removeWhenExistsWith R.removeLink $
fromOsPath $ looseObjectFile r s
removeBad s = do
void $ tryIO $ allowRead $ fromOsPath $ looseObjectFile r s
void $ tryIO $ allowRead $ looseObjectFile r s
whenM (isMissing s r) $
removeLoose s
@ -85,7 +85,7 @@ explodePacks r = go =<< listPackFiles r
putStrLn "Unpacking all pack files."
forM_ packs $ \packfile -> do
-- Just in case permissions are messed up.
allowRead (fromOsPath packfile)
allowRead packfile
-- May fail, if pack file is corrupt.
void $ tryIO $
pipeWrite [Param "unpack-objects", Param "-r"] r' $ \h ->
@ -477,7 +477,7 @@ preRepair g = do
writeFile (fromOsPath headfile) "ref: refs/heads/master"
explodePackedRefsFile g
unless (repoIsLocalBare g) $
void $ tryIO $ allowWrite $ fromOsPath $ indexFile g
void $ tryIO $ allowWrite $ indexFile g
where
headfile = localGitDir g </> literalOsPath "HEAD"
validhead s = "ref: refs/" `isPrefixOf` s
@ -652,5 +652,5 @@ successfulRepair = fst
safeReadFile :: OsPath -> IO B.ByteString
safeReadFile f = do
allowRead (fromOsPath f)
allowRead f
F.readFile' f