KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGIT::REMOTE_TRANSPORT Class Reference

#include <kigit_transport.h>

Classes

struct  STATE
 

Public Member Functions

 REMOTE_TRANSPORT (KIGIT_REPO_MIXIN *aHandler, git_remote *aRemote=nullptr, bool aFollowRedirects=true)
 aHandler supplies the session and records progress, the credentials offered and why a call failed.
 
 ~REMOTE_TRANSPORT ()
 
 REMOTE_TRANSPORT (const REMOTE_TRANSPORT &)=delete
 
REMOTE_TRANSPORT & operator= (const REMOTE_TRANSPORT &)=delete
 
int Fetch (std::vector< wxString > *aBranches=nullptr)
 Fetch as git fetch would. aBranches, when given, receives the branches the remote advertised.
 
int Push (const std::function< wxString()> &aConnected)
 Connect, then push the refspec aConnected answers, so the caller can check what it pushes after a connection that may have taken long.
 
int Check ()
 Connect, which proves the credentials and the host key without transferring anything.
 
int Clone (const wxString &aUrl, const wxString &aPath, git_repository **aRepo)
 Clone aUrl into aPath. The new repository is returned in aRepo for the caller to free.
 
const KIGIT_ERROR_INFO & Error () const
 libgit2's error for the last call that failed, read before anything else could replace it
 

Private Member Functions

int connect (git_direction aDirection, const git_remote_callbacks &aCallbacks)
 

Private Attributes

std::unique_ptr< STATE > m_state
 
git_remote * m_remote
 
bool m_followRedirects
 

Detailed Description

Definition at line 46 of file kigit_transport.h.

Constructor & Destructor Documentation

◆ REMOTE_TRANSPORT() [1/2]

KIGIT::REMOTE_TRANSPORT::REMOTE_TRANSPORT ( KIGIT_REPO_MIXIN * aHandler,
git_remote * aRemote = nullptr,
bool aFollowRedirects = true )
explicit

aHandler supplies the session and records progress, the credentials offered and why a call failed.

aRemote is the caller's and must outlive the transport. A transport for a clone takes none. Without aFollowRedirects a push the server redirects fails, so it reaches only the address the caller checked. Older libgit2 versions cannot enforce this and use their default redirect behavior.

Definition at line 473 of file kigit_transport.cpp.

References m_followRedirects, m_remote, and m_state.

Referenced by operator=(), and REMOTE_TRANSPORT().

◆ ~REMOTE_TRANSPORT()

KIGIT::REMOTE_TRANSPORT::~REMOTE_TRANSPORT ( )
default

◆ REMOTE_TRANSPORT() [2/2]

KIGIT::REMOTE_TRANSPORT::REMOTE_TRANSPORT ( const REMOTE_TRANSPORT & )
delete

References REMOTE_TRANSPORT().

Member Function Documentation

◆ Check()

int KIGIT::REMOTE_TRANSPORT::Check ( )

Connect, which proves the credentials and the host key without transferring anything.

Definition at line 588 of file kigit_transport.cpp.

References connect(), m_remote, and m_state.

Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), and operator=().

◆ Clone()

int KIGIT::REMOTE_TRANSPORT::Clone ( const wxString & aUrl,
const wxString & aPath,
git_repository ** aRepo )

Clone aUrl into aPath. The new repository is returned in aRepo for the caller to free.

Definition at line 600 of file kigit_transport.cpp.

References git_repository, and m_state.

Referenced by LIBGIT_BACKEND::Clone(), and operator=().

◆ connect()

int KIGIT::REMOTE_TRANSPORT::connect ( git_direction aDirection,
const git_remote_callbacks & aCallbacks )
private

Definition at line 485 of file kigit_transport.cpp.

References m_followRedirects, m_remote, and m_state.

Referenced by Check(), Fetch(), operator=(), and Push().

◆ Error()

const KIGIT_ERROR_INFO & KIGIT::REMOTE_TRANSPORT::Error ( ) const

libgit2's error for the last call that failed, read before anything else could replace it

Definition at line 624 of file kigit_transport.cpp.

References m_state.

Referenced by LIBGIT_BACKEND::Clone(), fetchRemote(), DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::Push().

◆ Fetch()

int KIGIT::REMOTE_TRANSPORT::Fetch ( std::vector< wxString > * aBranches = nullptr)

Fetch as git fetch would. aBranches, when given, receives the branches the remote advertised.

Definition at line 513 of file kigit_transport.cpp.

References connect(), m_remote, m_state, and name.

Referenced by fetchRemote(), and operator=().

◆ operator=()

REMOTE_TRANSPORT & KIGIT::REMOTE_TRANSPORT::operator= ( const REMOTE_TRANSPORT & )
delete

◆ Push()

int KIGIT::REMOTE_TRANSPORT::Push ( const std::function< wxString()> & aConnected)

Connect, then push the refspec aConnected answers, so the caller can check what it pushes after a connection that may have taken long.

An empty answer disconnects and returns GIT_EUSER.

Definition at line 548 of file kigit_transport.cpp.

References connect(), m_followRedirects, m_remote, and m_state.

Referenced by BOOST_AUTO_TEST_CASE(), operator=(), and LIBGIT_BACKEND::Push().

Member Data Documentation

◆ m_followRedirects

bool KIGIT::REMOTE_TRANSPORT::m_followRedirects
private

Definition at line 87 of file kigit_transport.h.

Referenced by connect(), Push(), and REMOTE_TRANSPORT().

◆ m_remote

git_remote* KIGIT::REMOTE_TRANSPORT::m_remote
private

Definition at line 86 of file kigit_transport.h.

Referenced by Check(), connect(), Fetch(), Push(), and REMOTE_TRANSPORT().

◆ m_state

std::unique_ptr<STATE> KIGIT::REMOTE_TRANSPORT::m_state
private

Definition at line 85 of file kigit_transport.h.

Referenced by Check(), Clone(), connect(), Error(), Fetch(), Push(), and REMOTE_TRANSPORT().


The documentation for this class was generated from the following files: