make path absolute for display

Avoid suggesting the user add "." to safe.directory.
This commit is contained in:
Joey Hess 2022-05-31 12:17:27 -04:00
parent d7e338f221
commit f35c551d35
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -229,19 +229,20 @@ objectDirNotPresent = do
return (not exists)
guardSafeToUseRepo :: Annex a -> Annex a
guardSafeToUseRepo a = do
repopath <- fromRepo Git.repoPath
ifM (inRepo Git.Config.checkRepoConfigInaccessible)
( giveup $ unlines $
guardSafeToUseRepo a = ifM (inRepo Git.Config.checkRepoConfigInaccessible)
( do
repopath <- fromRepo Git.repoPath
p <- liftIO $ absPath repopath
giveup $ unlines $
[ "Git refuses to operate in this repository,"
, "probably because it is owned by someone else."
, ""
-- This mirrors git's wording.
, "To add an exception for this directory, call:"
, "\tgit config --global --add safe.directory " ++ fromRawFilePath repopath
, "\tgit config --global --add safe.directory " ++ fromRawFilePath p
]
, a
)
, a
)
{- Initialize if it can do so automatically. Avoids failing if it cannot.
-