remove uuid from url when calling git credential

The user doesn't want to see a uuid in the prompt.

Also, when a http server is proxying, multiple remotes will have the
same base url, and the same password will work for them all.
This commit is contained in:
Joey Hess 2024-07-23 18:21:01 -04:00
parent b89c784a9b
commit 75771772ec
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 6 additions and 2 deletions

View file

@ -24,7 +24,6 @@ import P2P.Http.Url
import Annex.Common
import P2P.Protocol hiding (Offset, Bypass, auth)
import Annex.Concurrent
import Messages
import Utility.Url (BasicAuth(..))
import qualified Git.Credential as Git
@ -100,7 +99,9 @@ p2pHttpClient rmt fallback clientaction =
case p2pHttpUrlString <$> remoteAnnexP2PHttpUrl (gitconfig rmt) of
Nothing -> error "internal"
Just url -> do
cred <- prompt (inRepo $ Git.getUrlCredential url)
cred <- prompt $
inRepo $ Git.getUrlCredential $
p2pHttpUrlWithoutUUID url
let mauth = do
ba <- Git.credentialBasicAuth cred
return $ Auth

View file

@ -88,3 +88,6 @@ parseP2PHttpUrl us
, baseUrlPort = port
}
#endif
p2pHttpUrlWithoutUUID :: String -> String
p2pHttpUrlWithoutUUID = reverse . dropWhile (/= '/') . reverse