This commit is contained in:
1 parent
59cd8951f6
commit
b93ae852e0
10 files changed
+327
-36
No files matched your search
@@ -828,6 +828,11 @@ pub trait GitCredentialProvider {
|
||||
server: &ServerId,
|
||||
application: &ApplicationId,
|
||||
) -> Result<GitCredential, GitError>;
|
||||
|
||||
fn credential_for(&self, remote: &GitRemote) -> Result<GitCredential, GitError> {
|
||||
let (_, server, application) = require_https_remote(remote)?;
|
||||
self.credential(server, application)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait SshPassphraseProvider {
|
||||
@@ -873,6 +878,10 @@ impl<P: GitCredentialProvider> GitCredentialProvider for GitRemoteCredentialOver
|
||||
) -> Result<GitCredential, GitError> {
|
||||
self.provider.credential(server, application)
|
||||
}
|
||||
|
||||
fn credential_for(&self, remote: &GitRemote) -> Result<GitCredential, GitError> {
|
||||
self.provider.credential_for(remote)
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: SshPassphraseProvider> SshPassphraseProvider for GitRemoteCredentialOverride<'_, P> {
|
||||
@@ -1856,8 +1865,7 @@ impl GitRepository {
|
||||
) -> Result<bool, GitError> {
|
||||
match configured.endpoint() {
|
||||
RemoteEndpoint::Https(_) => {
|
||||
let (_, server_id, application_id) = require_https_remote(configured)?;
|
||||
let credential = credentials.credential(server_id, application_id)?;
|
||||
let credential = credentials.credential_for(configured)?;
|
||||
self.fetch_embedded_https(configured, &credential, control)
|
||||
}
|
||||
RemoteEndpoint::Ssh(_) => {
|
||||
@@ -2171,8 +2179,8 @@ impl GitRepository {
|
||||
control.checkpoint(GitProgressPhase::Authenticating)?;
|
||||
match configured.endpoint() {
|
||||
RemoteEndpoint::Https(_) => {
|
||||
let (url, server_id, application_id) = require_https_remote(configured)?;
|
||||
let credential = credentials.credential(server_id, application_id)?;
|
||||
let (url, _, _) = require_https_remote(configured)?;
|
||||
let credential = credentials.credential_for(configured)?;
|
||||
let transport = ReqwestGitTransport;
|
||||
let mut client = ReceivePackClient::Https {
|
||||
url,
|
||||
@@ -2228,9 +2236,9 @@ impl GitRepository {
|
||||
control: &GitOperationControl,
|
||||
) -> Result<PushOutcome, GitError> {
|
||||
let context = self.prepare_push(configured, branch, control)?;
|
||||
let (url, server_id, application_id) = require_https_remote(configured)?;
|
||||
let (url, _, _) = require_https_remote(configured)?;
|
||||
control.checkpoint(GitProgressPhase::Authenticating)?;
|
||||
let credential = credentials.credential(server_id, application_id)?;
|
||||
let credential = credentials.credential_for(configured)?;
|
||||
let mut client = ReceivePackClient::Https {
|
||||
url,
|
||||
credential,
|
||||
|
||||
Reference in new issue
Block a user