remove uuid from url when calling git credential
authorJoey Hess <joeyh@joeyh.name>
Tue, 23 Jul 2024 22:21:01 +0000 (18:21 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 23 Jul 2024 22:21:01 +0000 (18:21 -0400)
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.

P2P/Http/Client.hs
P2P/Http/Url.hs

index 4b5ea987ed65abfe90dfbda188edc715c128b377..1d299c9cc80f74a24a0582c43769db0be503cad4 100644 (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
index e087edd9b38fd166ec233d353baef7e61a11e3ef..92439623fbda4b9404956009e3063063cbef303d 100644 (file)
@@ -88,3 +88,6 @@ parseP2PHttpUrl us
                        , baseUrlPort = port
                        }
 #endif
+
+p2pHttpUrlWithoutUUID :: String -> String
+p2pHttpUrlWithoutUUID = reverse . dropWhile (/= '/') . reverse