more OsPath conversion

Git.Types now uses it, as does TopFilePath, making for plenty of new
compile errors needing fixing.

Sponsored-by: Brock Spratlen
This commit is contained in:
Joey Hess 2025-01-23 16:15:00 -04:00
parent 12660314f1
commit ea775baccd
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
22 changed files with 159 additions and 163 deletions

View file

@ -99,7 +99,7 @@ read' repo = go repo
global :: IO (Maybe Repo)
global = do
home <- myHomeDir
ifM (doesFileExist $ home </> ".gitconfig")
ifM (doesFileExist $ toOsPath home </> literalOsPath ".gitconfig")
( Just <$> withCreateProcess p go
, return Nothing
)
@ -153,22 +153,22 @@ store' k v repo = repo
-}
updateLocation :: Repo -> IO Repo
updateLocation r@(Repo { location = LocalUnknown d }) = case isBare r of
Just True -> ifM (doesDirectoryExist (fromRawFilePath dotgit))
Just True -> ifM (doesDirectoryExist dotgit)
( updateLocation' r $ Local dotgit Nothing
, updateLocation' r $ Local d Nothing
)
Just False -> mknonbare
{- core.bare not in config, probably because safe.directory
- did not allow reading the config -}
Nothing -> ifM (Git.Construct.isBareRepo (fromRawFilePath d))
Nothing -> ifM (Git.Construct.isBareRepo d)
( mkbare
, mknonbare
)
where
dotgit = d P.</> ".git"
dotgit = d </> literalOsPath ".git"
-- git treats eg ~/foo as a bare git repository located in
-- ~/foo/.git if ~/foo/.git/config has core.bare=true
mkbare = ifM (doesDirectoryExist (fromRawFilePath dotgit))
mkbare = ifM (doesDirectoryExist dotgit)
( updateLocation' r $ Local dotgit Nothing
, updateLocation' r $ Local d Nothing
)