Avoid Git.Config.updateLocation adding "/.git" to the end of the repo
path to a bare repo when git config is not allowed to list the configs due to the CVE-2022-24765 fix. That resulted in a confusing error message, and prevented the nice message that explains how to mark the repo as safe to use. Made isBare a tristate so that the case where core.bare is not returned can be handled. The handling in updateLocation is to check if the directory contains config and objects and if so assume it's bare. Note that if that heuristic is somehow wrong, it would construct a repo that thinks it's bare but is not. That could cause follow-on problems, but since git-annex then checks checkRepoConfigInaccessible, and skips using the repo anyway, a wrong guess should not be a problem. Sponsored-by: Luke Shumaker on Patreon
This commit is contained in:
parent
12b45d3b89
commit
c1ef4a7481
7 changed files with 39 additions and 30 deletions
|
@ -81,7 +81,7 @@ get = do
|
|||
}
|
||||
r <- Git.Config.read $ (newFrom loc)
|
||||
{ gitDirSpecifiedExplicitly = True }
|
||||
return $ if Git.Config.isBare r
|
||||
return $ if fromMaybe False (Git.Config.isBare r)
|
||||
then r { location = (location r) { worktree = Nothing } }
|
||||
else r
|
||||
configure Nothing Nothing = giveup "Not in a git repository."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue