Override safe.bareRepository for git remotes

Fix using git remotes that are bare when git is configured
with safe.bareRepository = explicit

Sponsored-by: Dartmouth College's DANDI project
This commit is contained in:
Joey Hess 2023-09-07 14:56:26 -04:00
parent cbfd214993
commit baf8e4f6ed
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 37 additions and 19 deletions

View file

@ -124,11 +124,7 @@ builtin cmd dir params = do
mkrepo = do
r <- Git.Construct.repoAbsPath (toRawFilePath dir)
>>= Git.Construct.fromAbsPath
{- Since the path to the repository was specified
- explicitly, CVE-2022-24765 is not a concern,
- so tell git to treat the repository directory as safe.
-}
let r' = r { safeDirectory = True }
let r' = r { repoPathSpecifiedExplicitly = True }
Git.Config.read r'
`catchIO` \_ -> do
hn <- fromMaybe "unknown" <$> getHostname