Coding policy fixes.
This commit is contained in:
@@ -43,6 +43,7 @@ KIGIT_COMMON::KIGIT_COMMON( git_repository* aRepo ) :
|
||||
m_nextPublicKey( 0 ), m_secretFetched( false )
|
||||
{}
|
||||
|
||||
|
||||
KIGIT_COMMON::KIGIT_COMMON( const KIGIT_COMMON& aOther ) :
|
||||
// Initialize base class and member variables
|
||||
m_repo( aOther.m_repo ),
|
||||
@@ -53,6 +54,7 @@ KIGIT_COMMON::KIGIT_COMMON( const KIGIT_COMMON& aOther ) :
|
||||
m_username( aOther.m_username ),
|
||||
m_password( aOther.m_password ),
|
||||
m_testedTypes( aOther.m_testedTypes ),
|
||||
|
||||
// The mutex is default-initialized, not copied
|
||||
m_gitActionMutex(),
|
||||
m_publicKeys( aOther.m_publicKeys ),
|
||||
@@ -61,6 +63,7 @@ KIGIT_COMMON::KIGIT_COMMON( const KIGIT_COMMON& aOther ) :
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
KIGIT_COMMON::~KIGIT_COMMON()
|
||||
{}
|
||||
|
||||
@@ -587,6 +590,7 @@ wxString KIGIT_COMMON::GetRemotename() const
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void KIGIT_COMMON::SetSSHKey( const wxString& aKey )
|
||||
{
|
||||
auto it = std::find( m_publicKeys.begin(), m_publicKeys.end(), aKey );
|
||||
@@ -706,6 +710,7 @@ void KIGIT_COMMON::UpdateCurrentBranchInfo()
|
||||
updatePublicKeys();
|
||||
}
|
||||
|
||||
|
||||
KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType() const
|
||||
{
|
||||
wxString remote = m_remote;
|
||||
@@ -726,6 +731,7 @@ KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType() const
|
||||
return GIT_CONN_TYPE::GIT_CONN_LOCAL;
|
||||
}
|
||||
|
||||
|
||||
void KIGIT_COMMON::updateConnectionType()
|
||||
{
|
||||
if( m_remote.StartsWith( "https://" ) || m_remote.StartsWith( "http://" ) )
|
||||
@@ -769,6 +775,7 @@ void KIGIT_COMMON::updateConnectionType()
|
||||
{
|
||||
// SSH format: git@hostname:path
|
||||
size_t colonPos = m_remote.find( ':' );
|
||||
|
||||
if( colonPos != wxString::npos )
|
||||
m_hostname = m_remote.Mid( 4, colonPos - 4 );
|
||||
}
|
||||
@@ -818,7 +825,7 @@ int KIGIT_COMMON::HandleSSHKeyAuthentication( git_cred** aOut, const wxString& a
|
||||
wxLogTrace( traceGit, "Testing %s\n", sshKey );
|
||||
|
||||
if( git_credential_ssh_key_new( aOut, aUsername.mbc_str(), sshPubKey.mbc_str(), sshKey.mbc_str(),
|
||||
password.mbc_str() ) != GIT_OK )
|
||||
password.mbc_str() ) != GIT_OK )
|
||||
{
|
||||
wxLogTrace( traceGit, "Failed to create SSH key credential for %s: %s",
|
||||
aUsername, KIGIT_COMMON::GetLastGitError() );
|
||||
@@ -839,6 +846,7 @@ int KIGIT_COMMON::HandlePlaintextAuthentication( git_cred** aOut, const wxString
|
||||
return GIT_OK;
|
||||
}
|
||||
|
||||
|
||||
int KIGIT_COMMON::HandleSSHAgentAuthentication( git_cred** aOut, const wxString& aUsername )
|
||||
{
|
||||
if( git_credential_ssh_key_from_agent( aOut, aUsername.mbc_str() ) != GIT_OK )
|
||||
@@ -999,6 +1007,7 @@ extern "C" int credentials_cb( git_cred** aOut, const char* aUrl, const char* aU
|
||||
wxString username = parent->GetUsername().Trim().Trim( false );
|
||||
wxLogTrace( traceGit, "Username credential for %s at %s with allowed type %d",
|
||||
username, aUrl, aAllowedTypes );
|
||||
|
||||
if( git_credential_username_new( aOut, username.ToStdString().c_str() ) != GIT_OK )
|
||||
{
|
||||
wxLogTrace( traceGit, "Failed to create username credential for %s: %s",
|
||||
@@ -1036,6 +1045,7 @@ extern "C" int credentials_cb( git_cred** aOut, const char* aUrl, const char* aU
|
||||
|
||||
git_error_clear();
|
||||
git_error_set_str( GIT_ERROR_NET, _( "Unable to authenticate" ).mbc_str() );
|
||||
|
||||
// Otherwise, we did try something but we failed, so return an authentication error
|
||||
return GIT_EAUTH;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user