KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGIT_COMMON Class Reference

The project's git session. More...

#include <kicad_git_common.h>

Inheritance diagram for KIGIT_COMMON:
GIT_COMMIT_HANDLER

Classes

struct  CREDENTIAL_IDENTITY
 The remote the credential prompt was opened for. More...
 
class  OPERATION_GUARD
 Publishes a token for as long as its operation runs. More...
 
struct  PROMPTED_CREDENTIALS
 What the credential prompt collected. More...
 
struct  REMOTE_URL
 A transport address with any embedded credentials extracted. More...
 

Public Types

enum class  GIT_STATUS {
  GIT_STATUS_UNTRACKED , GIT_STATUS_CURRENT , GIT_STATUS_MODIFIED , GIT_STATUS_ADDED ,
  GIT_STATUS_DELETED , GIT_STATUS_BEHIND , GIT_STATUS_AHEAD , GIT_STATUS_CONFLICTED ,
  GIT_STATUS_IGNORED , GIT_STATUS_LAST
}
 
enum class  GIT_CONN_TYPE { GIT_CONN_HTTPS = 0 , GIT_CONN_SSH , GIT_CONN_LOCAL , GIT_CONN_LAST }
 
using CANCEL_TOKEN = std::shared_ptr<std::atomic<bool>>
 One token per operation.
 

Public Member Functions

 KIGIT_COMMON (git_repository *aRepo, const wxString &aProjectPath=wxEmptyString)
 aProjectPath is the absolute project directory.
 
 KIGIT_COMMON (const KIGIT_COMMON &aOther)
 
 ~KIGIT_COMMON ()
 
git_repository * GetRepo () const
 
void SetRepo (git_repository *aRepo)
 
wxString GetCurrentBranchName () const
 
wxString GetHeadCommitId () const
 Full commit ID at HEAD, or empty for an unborn or missing HEAD.
 
std::vector< KIGIT_BRANCH_INFO > GetBranches () const
 Local and remote branches with their tip commits.
 
KIGIT_BRANCH_DETAIL GetBranchDetail (const wxString &aBranch) const
 
std::vector< wxString > GetProjectDirs ()
 Return a vector of project files in the repository.
 
std::pair< std::set< wxString >, std::set< wxString > > GetDifferentFiles () const
 Return a pair of sets of files that differ locally from the remote repository The first set is files that have been committed locally but not pushed The second set is files that have been committed remotely but not pulled.
 
wxString GetUsername () const
 
wxString GetPassword ()
 The secret for the remote, read without ever prompting, so it is safe on a transfer worker.
 
bool SecretRead () const
 False while the keyring has not been read for the current remote.
 
GIT_CONN_TYPE GetConnType () const
 
void SetConnType (GIT_CONN_TYPE aConnType)
 For a remote whose address names no transport, the user picks one in the prompt.
 
void SetUsername (const wxString &aUsername)
 
void SetPassword (const wxString &aPassword)
 
void SetSSHKey (const wxString &aSSHKey)
 
wxString GetSSHKey () const
 The key the project was set up with, even when its file is gone, otherwise the first key offered.
 
wxString GetFirstOfferedSSHKey () const
 The key the next attempt will try first, for the credential prompt to show.
 
wxString GetAcceptedSSHKey () const
 The encrypted key the server last accepted for this remote, so the credential prompt asks for the right passphrase.
 
void SetAcceptedSSHKey (const wxString &aKey)
 
CREDENTIAL_IDENTITY GetCredentialIdentity () const
 
bool ApplyPromptedCredentials (const CREDENTIAL_IDENTITY &aFor, const PROMPTED_CREDENTIALS &aEntered)
 Apply what the prompt collected, unless the session has moved to another remote since aFor was taken.
 
bool HasLocalCommits () const
 True when HEAD has commits its upstream does not, or has no upstream yet.
 
std::optional< KIGIT_UPSTREAM_STATUS > UpstreamStatus () const
 The current branch against its upstream.
 
bool IsPullRebaseConfigured () const
 True when the repository is set to rebase rather than merge when getting changes.
 
bool IsHeadDetached () const
 True when HEAD points at a commit rather than a branch, as after checking out a tag.
 
std::optional< size_t > GetUnmergedCommitCount (const wxString &aBranch) const
 Commits in aBranch that HEAD does not contain. No value when either cannot be read.
 
bool HasUncommittedTrackedChanges (bool *aReadOk=nullptr) const
 
std::vector< wxString > GetRecentCommitMessages (size_t aMax) const
 
std::vector< KIGIT_COMMIT_INFO > GetRecentCommits (size_t aMax=50, const KIGIT_HISTORY_FILTER &aFilter={}) const
 
KIGIT_COMMIT_DETAIL GetCommitDetail (const wxString &aHash) const
 
wxString GetLastCommitMessage () const
 
std::vector< KIGIT_STASH_INFO > GetStashes () const
 
KIGIT_STASH_DETAIL GetStashDetail (const wxString &aId) const
 
std::vector< KIGIT_TAG_INFO > GetTags () const
 
KIGIT_TAG_DETAIL GetTagDetail (const wxString &aName) const
 
bool IsHeadUnborn () const
 True while the repository has no commits, so HEAD names a branch that does not exist yet.
 
bool CreateBranch (const wxString &aName, const wxString &aFrom=wxEmptyString)
 
bool StartUnbornBranch (const wxString &aName)
 Point HEAD at a branch that does not exist yet, so the first commit creates it.
 
bool DeleteBranch (const wxString &aName)
 
bool StashSave (const wxString &aMessage)
 Set the uncommitted tracked changes aside as a new stash, as git stash push would.
 
bool StashApply (size_t aIndex)
 
bool StashPop (size_t aIndex)
 
bool StashDrop (size_t aIndex)
 
bool CreateTag (const wxString &aName, const wxString &aMessage=wxEmptyString)
 
bool DeleteTag (const wxString &aName)
 
bool CheckoutTag (const wxString &aName)
 
bool AddRemote (const wxString &aName, const wxString &aUrl)
 
bool SetRemoteUrl (const wxString &aName, const wxString &aUrl)
 
bool RemoveRemote (const wxString &aName)
 
bool SetUserConfig (const wxString &aName, const wxString &aEmail)
 
bool GetMergeConflicts (const wxString &aStageDir, wxString &aHeadOid, wxString &aTheirsOid, std::vector< KIGIT_CONFLICT_SIDES > &aConflicts, wxString &aError)
 Recompute the merge in memory and extract each conflicted file's three versions into aStageDir, without touching the repository.
 
RestoreResult RestoreVersion (const wxString &aCommitHash, KIGIT_ERROR_MESSAGE &aError)
 Restore the project as it was at aCommitHash, recorded as a new commit on top of the current head.
 
bool DiscardChanges (const std::vector< wxString > &aPaths, wxString &aError)
 Put the given working directory relative paths back to their committed state.
 
bool IsPathInHead (const wxString &aPath)
 True when the working directory relative path exists in the HEAD commit's tree.
 
bool IsPathConflicted (const wxString &aPath) const
 True while aPath is one of the files a merge or rebase stopped on.
 
bool IsOperationInProgress () const
 True while a merge, rebase, cherry-pick or revert is in progress, which refuses commits.
 
GitOperation OperationInProgress () const
 Which operation that is, so the panel can name it.
 
bool AbandonOperation (wxString &aError)
 Drop that operation and return to the last commit. The caller holds the action lock.
 
MergeCommitResult CreateMergedCommit (const wxString &aExpectedHeadOid, const wxString &aTheirsOid, const std::vector< std::pair< wxString, wxString > > &aResolvedFiles, KIGIT_ERROR_MESSAGE &aError)
 Redo the merge with each conflicted path replaced by its resolved file, then commit and check out.
 
bool HasPushAndPullRemote () const
 
void UpdateCurrentBranchInfo ()
 
void SyncRemoteUrl (const wxString &aRawUrl)
 Bind the session to the URL a transfer is about to connect to.
 
void FollowRewrittenUrl (const wxString &aRawUrl)
 Bind the session to a URL that url.insteadOf rewrote, keeping the username, password and key entered for the original.
 
wxString GetGitRootDirectory () const
 
wxString GetRemotename () const
 
std::vector< std::pair< wxString, wxString > > GetRemotes () const
 Returns every remote as a (name, URL) pair.
 
wxDateTime GetLastFetchTime () const
 
std::pair< int, int > GetWorkingTreeLineStats (const std::set< wxString > &aPaths) const
 
wxString GetRemoteNameOrDefault () const
 Returns GetRemotename() when non-empty, otherwise "origin".
 
wxString GetPushUrl (const wxString &aRemoteName) const
 The address a push to aRemoteName connects to, its push URL or else its URL. Empty without one.
 
void SetProjectDir (const wxString &aProjectDir)
 Keep symlinks in the repository path so Git status paths match the project tree.
 
wxString GetProjectDir () const
 Return the path set by SetProjectDir(), or the repository's working directory.
 
std::optional< wxString > GetProjectPrefix () const
 Project folder relative to the repository, with a trailing slash.
 
void SetAttachError (const wxString &aError, const wxString &aTrustCommand=wxEmptyString)
 Why binding a repository last failed, for the panels to show. Empty on success.
 
const wxString & GetAttachError () const
 
const wxString & GetAttachTrustCommand () const
 The command that trusts a repository another user owns, when that is why attaching failed.
 
void ResetNextKey ()
 Start the next attempt from the first key, with the key that last connected to the current remote moved up.
 
void RememberWorkingSSHKey (const KIGIT_AUTH_ATTEMPT &aAttempt)
 Remember the key that connected for aAttempt, so the next connection offers it first.
 
wxString GetNextPublicKey ()
 By value, so the caller never holds a pointer into the vector.
 
void SetRemote (const wxString &aRemote)
 
wxString GetRemote () const
 
bool IsShuttingDown () const
 Background timers ask this before starting work of their own.
 
void SetShuttingDown (bool aCancel)
 Stop the operation running now and keep later ones from starting.
 
int SSHPortFor (const wxString &aHost) const
 The SSH port the session's remote names for aHost, 22 when it names none, or -1 when the remote is on another host or its port is not valid.
 
std::unique_lock< std::mutex > TryLockAction ()
 
std::unique_lock< std::mutex > TryLockActionFor (std::chrono::milliseconds aWait)
 TryLockAction that keeps trying for aWait before giving up.
 
std::unique_lock< std::mutex > LockAction ()
 
void AddRefreshListener (void *aOwner, std::function< void()> aCallback)
 
void RemoveRefreshListener (void *aOwner)
 
void NotifyRefreshListeners ()
 
GIT_TRANSFER_BUSY & Transfers ()
 The transfers running on this repository, which every window shows and may cancel. UI thread only.
 

Static Public Member Functions

static REMOTE_URL ParseRemoteURL (const wxString &aURL)
 
static bool DeferForSecret (const std::shared_ptr< KIGIT_COMMON > &aCommon, const std::weak_ptr< bool > &aOwner, std::function< void()> aRetry)
 Read the remote's secret from the keyring on the UI thread without blocking it, so an unlock prompt can show before a transfer starts.
 
static wxString GetLastGitError ()
 libgit2's last message, without credentials from any URL it quotes, so it is safe to show or trace.
 
static KIGIT_ERROR_INFO GetLastGitErrorInfo (int aCode)
 The error libgit2 holds for a call that returned aCode.
 
static CANCEL_TOKEN NewCancelToken ()
 

Static Public Attributes

static constexpr std::chrono::milliseconds ACTION_LOCK_WAIT { 2000 }
 Long enough for a status read to finish, short enough that a window does not look hung.
 

Protected Attributes

git_repository * m_repo
 
wxString m_projectDir
 
wxString m_projectPath
 
wxString m_attachError
 
wxString m_attachTrustCommand
 
GIT_CONN_TYPE m_connType
 
wxString m_remote
 
wxString m_urlUsername
 
wxString m_hostname
 
int m_port = 0
 
wxString m_username
 
wxString m_password
 
std::mutex m_gitActionMutex
 
std::mutex m_credentialsMutex
 Serializes the credential fields between the UI thread and the authentication callback's worker thread.
 
std::vector< std::pair< void *, std::function< void()> > > m_refreshListeners
 
GIT_TRANSFER_BUSY m_transfers
 

Private Member Functions

std::optional< KIGIT_AHEAD_BEHIND > compareRefs (const git_reference *aBranch, const git_reference *aBase) const
 Count commits unique to aBranch and aBase. No value if the history cannot be read.
 
CANCEL_TOKEN ActiveCancelToken () const
 
bool secretReadLocked () const
 SecretRead() for a caller already holding m_credentialsMutex.
 
wxString remoteNameWithoutUpstream () const
 Remote to use when HEAD names no upstream, empty when several remotes leave it ambiguous.
 
void updatePublicKeys ()
 
void rebuildPublicKeysUnlocked ()
 Rebuild m_publicKeys as the project key, when offerable, then the key that last connected to m_remote, then the discovered keys, and restart from the first.
 
void updateConnectionType ()
 
void updateConnectionTypeUnlocked ()
 Body of updateConnectionType, for callers that already hold m_credentialsMutex.
 

Private Attributes

std::vector< wxString > m_discoveredKeys
 
std::vector< wxString > m_publicKeys
 
wxString m_publicKeysHost
 
wxString m_projectSSHKey
 
wxString m_acceptedSSHKey
 
int m_nextPublicKey
 
bool m_secretFetched
 
std::mutex m_operationMutex
 Guarded together, so a shutdown cannot miss an operation registering itself at the same moment.
 
CANCEL_TOKEN m_activeCancel
 
bool m_shutdown = false
 

Friends

class GIT_PUSH_HANDLER
 
class GIT_PULL_HANDLER
 
class GIT_CLONE_HANDLER
 
class LIBGIT_BACKEND
 

Detailed Description

The project's git session.

A project can be open before it is ever put under version control, and integration can be turned off for it, so a session with no repository is a normal state rather than a programming error. Every method answers empty, false or nothing in that case.

Definition at line 242 of file kicad_git_common.h.

Member Typedef Documentation

◆ CANCEL_TOKEN

using KIGIT_COMMON::CANCEL_TOKEN = std::shared_ptr<std::atomic<bool>>

One token per operation.

Born uncancelled, so nothing has to be reset before an operation starts and one operation's cancel cannot reach another.

Definition at line 644 of file kicad_git_common.h.

Member Enumeration Documentation

◆ GIT_CONN_TYPE

enum class KIGIT_COMMON::GIT_CONN_TYPE
strong
Enumerator
GIT_CONN_HTTPS 
GIT_CONN_SSH 
GIT_CONN_LOCAL 
GIT_CONN_LAST 

Definition at line 302 of file kicad_git_common.h.

◆ GIT_STATUS

enum class KIGIT_COMMON::GIT_STATUS
strong
Enumerator
GIT_STATUS_UNTRACKED 
GIT_STATUS_CURRENT 
GIT_STATUS_MODIFIED 
GIT_STATUS_ADDED 
GIT_STATUS_DELETED 
GIT_STATUS_BEHIND 
GIT_STATUS_AHEAD 
GIT_STATUS_CONFLICTED 
GIT_STATUS_IGNORED 
GIT_STATUS_LAST 

Definition at line 288 of file kicad_git_common.h.

Constructor & Destructor Documentation

◆ KIGIT_COMMON() [1/2]

KIGIT_COMMON::KIGIT_COMMON ( git_repository * aRepo,
const wxString & aProjectPath = wxEmptyString )

aProjectPath is the absolute project directory.

Leave it empty for handlers that do not need a project folder.

Definition at line 60 of file kicad_git_common.cpp.

References GIT_CONN_LOCAL, git_repository, m_connType, m_nextPublicKey, m_projectPath, m_repo, and m_secretFetched.

Referenced by GIT_COMMIT_HANDLER::GIT_COMMIT_HANDLER(), KIGIT_COMMON(), and KIGIT_COMMON::OPERATION_GUARD::OPERATION_GUARD().

◆ KIGIT_COMMON() [2/2]

◆ ~KIGIT_COMMON()

KIGIT_COMMON::~KIGIT_COMMON ( )

Definition at line 95 of file kicad_git_common.cpp.

Member Function Documentation

◆ AbandonOperation()

bool KIGIT_COMMON::AbandonOperation ( wxString & aError)

Drop that operation and return to the last commit. The caller holds the action lock.

Definition at line 1699 of file kicad_git_common.cpp.

References GIT_BACKEND::AbandonOperation(), GetGitBackend(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ ActiveCancelToken()

CANCEL_TOKEN KIGIT_COMMON::ActiveCancelToken ( ) const
inlineprivate

Definition at line 764 of file kicad_git_common.h.

References m_activeCancel, and m_operationMutex.

Referenced by GetRecentCommits().

◆ AddRefreshListener()

void KIGIT_COMMON::AddRefreshListener ( void * aOwner,
std::function< void()> aCallback )

◆ AddRemote()

bool KIGIT_COMMON::AddRemote ( const wxString & aName,
const wxString & aUrl )

◆ ApplyPromptedCredentials()

bool KIGIT_COMMON::ApplyPromptedCredentials ( const CREDENTIAL_IDENTITY & aFor,
const PROMPTED_CREDENTIALS & aEntered )

Apply what the prompt collected, unless the session has moved to another remote since aFor was taken.

The check and the apply share one critical section, so a background fetch cannot slip between them. The per-attempt state is reset with it, so the next transfer starts over with these. Returns false, leaving everything alone, when the identity moved.

Definition at line 1997 of file kicad_git_common.cpp.

References KIGIT_COMMON::CREDENTIAL_IDENTITY::connType, KIGIT_COMMON::PROMPTED_CREDENTIALS::connType, m_connType, m_credentialsMutex, m_nextPublicKey, m_password, m_projectSSHKey, m_remote, m_secretFetched, m_username, KIGIT_COMMON::PROMPTED_CREDENTIALS::password, rebuildPublicKeysUnlocked(), KIGIT_COMMON::CREDENTIAL_IDENTITY::remote, KIGIT_COMMON::PROMPTED_CREDENTIALS::sshKey, KIGIT_COMMON::CREDENTIAL_IDENTITY::username, and KIGIT_COMMON::PROMPTED_CREDENTIALS::username.

Referenced by KIGIT::PromptForCredentials().

◆ CheckoutTag()

bool KIGIT_COMMON::CheckoutTag ( const wxString & aName)

◆ compareRefs()

std::optional< KIGIT_AHEAD_BEHIND > KIGIT_COMMON::compareRefs ( const git_reference * aBranch,
const git_reference * aBase ) const
private

Count commits unique to aBranch and aBase. No value if the history cannot be read.

Definition at line 910 of file kicad_git_common.cpp.

References KIGIT_AHEAD_BEHIND::ahead, KIGIT_AHEAD_BEHIND::behind, m_repo, and result.

Referenced by GetBranchDetail(), GetUnmergedCommitCount(), LIBGIT_BACKEND, and UpstreamStatus().

◆ CreateBranch()

◆ CreateMergedCommit()

MergeCommitResult KIGIT_COMMON::CreateMergedCommit ( const wxString & aExpectedHeadOid,
const wxString & aTheirsOid,
const std::vector< std::pair< wxString, wxString > > & aResolvedFiles,
KIGIT_ERROR_MESSAGE & aError )

Redo the merge with each conflicted path replaced by its resolved file, then commit and check out.

All or nothing.

aTheirsOid pins the remote commit, so a background fetch cannot change what gets merged. An empty resolved-file path records "the file is deleted". A failure leaves its reason in aError's details, and a summary only when the next step is known.

Definition at line 1712 of file kicad_git_common.cpp.

References GIT_BACKEND::CreateMergedCommit(), GetGitBackend(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ CreateTag()

bool KIGIT_COMMON::CreateTag ( const wxString & aName,
const wxString & aMessage = wxEmptyString )

◆ DeferForSecret()

bool KIGIT_COMMON::DeferForSecret ( const std::shared_ptr< KIGIT_COMMON > & aCommon,
const std::weak_ptr< bool > & aOwner,
std::function< void()> aRetry )
static

Read the remote's secret from the keyring on the UI thread without blocking it, so an unlock prompt can show before a transfer starts.

Returns false when nothing needs reading. Otherwise aRetry runs on the UI thread once the read finishes, unless aOwner or aCommon has gone by then. A locked, dismissed or empty keyring still runs aRetry, so the transfer goes ahead and prompts as usual.

Definition at line 224 of file kicad_git_common.cpp.

References KIPLATFORM::SECRETS::GetSecretAsync().

Referenced by GIT_COMMIT_PANE::deferForSecret(), PANEL_GIT_BRANCHES::onForcePush(), and GIT_ADVANCED_DIALOG::startFetch().

◆ DeleteBranch()

bool KIGIT_COMMON::DeleteBranch ( const wxString & aName)

◆ DeleteTag()

bool KIGIT_COMMON::DeleteTag ( const wxString & aName)

◆ DiscardChanges()

bool KIGIT_COMMON::DiscardChanges ( const std::vector< wxString > & aPaths,
wxString & aError )

Put the given working directory relative paths back to their committed state.

A path that is not in HEAD keeps its file and loses its staged entry.

Definition at line 1639 of file kicad_git_common.cpp.

References GIT_BACKEND::DiscardChanges(), GetGitBackend(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ FollowRewrittenUrl()

void KIGIT_COMMON::FollowRewrittenUrl ( const wxString & aRawUrl)

Bind the session to a URL that url.insteadOf rewrote, keeping the username, password and key entered for the original.

Definition at line 2206 of file kicad_git_common.cpp.

References m_credentialsMutex, m_password, m_secretFetched, m_username, and SyncRemoteUrl().

Referenced by DIALOG_GIT_REPOSITORY::OnTestClick().

◆ GetAcceptedSSHKey()

wxString KIGIT_COMMON::GetAcceptedSSHKey ( ) const

The encrypted key the server last accepted for this remote, so the credential prompt asks for the right passphrase.

Empty when no server has accepted one.

Definition at line 1976 of file kicad_git_common.cpp.

References m_acceptedSSHKey, and m_credentialsMutex.

Referenced by initialSSHKey().

◆ GetAttachError()

const wxString & KIGIT_COMMON::GetAttachError ( ) const
inline

Definition at line 599 of file kicad_git_common.h.

References m_attachError.

◆ GetAttachTrustCommand()

const wxString & KIGIT_COMMON::GetAttachTrustCommand ( ) const
inline

The command that trusts a repository another user owns, when that is why attaching failed.

Definition at line 602 of file kicad_git_common.h.

References m_attachTrustCommand.

◆ GetBranchDetail()

KIGIT_BRANCH_DETAIL KIGIT_COMMON::GetBranchDetail ( const wxString & aBranch) const

◆ GetBranches()

std::vector< KIGIT_BRANCH_INFO > KIGIT_COMMON::GetBranches ( ) const

Local and remote branches with their tip commits.

Symbolic aliases are omitted. Callers choose the display order.

Definition at line 573 of file kicad_git_common.cpp.

References KIGIT::DecodeRepoText(), GetLastGitError(), info, m_repo, and traceGit.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PROJECT_TREE_PANE::onGitSwitchBranch(), GIT_ADVANCED_DIALOG::populateTopBar(), and GIT_COMMIT_PANE::RefreshFileList().

◆ GetCommitDetail()

◆ GetConnType()

KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType ( ) const

◆ GetCredentialIdentity()

KIGIT_COMMON::CREDENTIAL_IDENTITY KIGIT_COMMON::GetCredentialIdentity ( ) const

Definition at line 1990 of file kicad_git_common.cpp.

References m_connType, m_credentialsMutex, m_remote, and m_username.

Referenced by KIGIT::PromptForCredentials().

◆ GetCurrentBranchName()

◆ GetDifferentFiles()

std::pair< std::set< wxString >, std::set< wxString > > KIGIT_COMMON::GetDifferentFiles ( ) const

Return a pair of sets of files that differ locally from the remote repository The first set is files that have been committed locally but not pushed The second set is files that have been committed remotely but not pulled.

Definition at line 773 of file kicad_git_common.cpp.

References KIGIT::CollectDiffDeltas(), GetLastGitError(), IsShuttingDown(), m_repo, and traceGit.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ GetFirstOfferedSSHKey()

wxString KIGIT_COMMON::GetFirstOfferedSSHKey ( ) const

The key the next attempt will try first, for the credential prompt to show.

Empty when no key file can be offered.

Definition at line 1959 of file kicad_git_common.cpp.

References KIGIT::IsOfferableSSHKey(), m_credentialsMutex, m_projectSSHKey, and m_publicKeys.

Referenced by initialSSHKey().

◆ GetGitRootDirectory()

wxString KIGIT_COMMON::GetGitRootDirectory ( ) const

◆ GetHeadCommitId()

wxString KIGIT_COMMON::GetHeadCommitId ( ) const

Full commit ID at HEAD, or empty for an unborn or missing HEAD.

The caller holds the action lock when capturing this alongside the branch name for a later operation.

Definition at line 169 of file kicad_git_common.cpp.

References m_repo.

Referenced by PANEL_GIT_BRANCHES::onForcePush(), and GIT_COMMIT_PANE::submitPush().

◆ GetLastCommitMessage()

wxString KIGIT_COMMON::GetLastCommitMessage ( ) const

Definition at line 270 of file kicad_git_common.cpp.

References KIGIT::DecodeRepoText(), m_repo, and message.

Referenced by GIT_COMMIT_PANE::BeginAmend().

◆ GetLastFetchTime()

wxDateTime KIGIT_COMMON::GetLastFetchTime ( ) const

Definition at line 388 of file kicad_git_common.cpp.

References m_repo.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetLastGitError()

◆ GetLastGitErrorInfo()

KIGIT_ERROR_INFO KIGIT_COMMON::GetLastGitErrorInfo ( int aCode)
static

The error libgit2 holds for a call that returned aCode.

Read it straight after the call, because the callbacks and cleanup that follow can replace it.

Definition at line 2276 of file kicad_git_common.cpp.

References info.

Referenced by KIGIT::REMOTE_TRANSPORT::STATE::Fail(), DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::SetupRemote().

◆ GetMergeConflicts()

bool KIGIT_COMMON::GetMergeConflicts ( const wxString & aStageDir,
wxString & aHeadOid,
wxString & aTheirsOid,
std::vector< KIGIT_CONFLICT_SIDES > & aConflicts,
wxString & aError )

Recompute the merge in memory and extract each conflicted file's three versions into aStageDir, without touching the repository.

aHeadOid pins HEAD for CreateMergedCommit.

Definition at line 1705 of file kicad_git_common.cpp.

References GetGitBackend(), GIT_BACKEND::GetMergeConflicts(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::resolvePullConflicts().

◆ GetNextPublicKey()

wxString KIGIT_COMMON::GetNextPublicKey ( )

By value, so the caller never holds a pointer into the vector.

Definition at line 2098 of file kicad_git_common.cpp.

References KIGIT::IsOfferableSSHKey(), m_credentialsMutex, m_nextPublicKey, and m_publicKeys.

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetPassword()

wxString KIGIT_COMMON::GetPassword ( )

◆ GetProjectDir()

wxString KIGIT_COMMON::GetProjectDir ( ) const

Return the path set by SetProjectDir(), or the repository's working directory.

Definition at line 105 of file kicad_git_common.cpp.

References m_projectDir, and m_repo.

Referenced by GetProjectPrefix().

◆ GetProjectDirs()

std::vector< wxString > KIGIT_COMMON::GetProjectDirs ( )

Return a vector of project files in the repository.

Sorted by the depth of the project file in the directory tree

Returns
std::vector<wxString> of project files

Definition at line 704 of file kicad_git_common.cpp.

References GetLastGitError(), m_repo, and traceGit.

Referenced by BOOST_AUTO_TEST_CASE(), and KICAD_MANAGER_CONTROL::NewFromRepository().

◆ GetProjectPrefix()

std::optional< wxString > KIGIT_COMMON::GetProjectPrefix ( ) const

Project folder relative to the repository, with a trailing slash.

An empty string means the repository root. No value means the folder is unknown.

Definition at line 122 of file kicad_git_common.cpp.

References GetProjectDir(), m_projectPath, m_repo, and KIGIT::PROJECT_GIT_UTILS::ProjectPrefix().

Referenced by BuildGitChangeEntries(), KIGIT::IgnoreState(), KIGIT::PROJECT_GIT_UTILS::LfsRefusal(), KIGIT::PROJECT_GIT_UTILS::ProjectUsesGitLfs(), and LIBGIT_BACKEND::RestoreVersion().

◆ GetPushUrl()

wxString KIGIT_COMMON::GetPushUrl ( const wxString & aRemoteName) const

The address a push to aRemoteName connects to, its push URL or else its URL. Empty without one.

Definition at line 1824 of file kicad_git_common.cpp.

References m_repo.

Referenced by PANEL_GIT_BRANCHES::onForcePush().

◆ GetRecentCommitMessages()

std::vector< wxString > KIGIT_COMMON::GetRecentCommitMessages ( size_t aMax) const

◆ GetRecentCommits()

◆ GetRemote()

◆ GetRemotename()

wxString KIGIT_COMMON::GetRemotename ( ) const

◆ GetRemoteNameOrDefault()

wxString KIGIT_COMMON::GetRemoteNameOrDefault ( ) const

Returns GetRemotename() when non-empty, otherwise "origin".

Centralizes the fallback policy used by push/pull/fetch paths.

Definition at line 1813 of file kicad_git_common.cpp.

References GetRemotename().

Referenced by adoptRemoteHistory(), fetchRemote(), HasPushAndPullRemote(), PANEL_GIT_BRANCHES::onForcePush(), LIBGIT_BACKEND::PerformPull(), LIBGIT_BACKEND::Push(), and resolveMissingRemote().

◆ GetRemotes()

std::vector< std::pair< wxString, wxString > > KIGIT_COMMON::GetRemotes ( ) const

Returns every remote as a (name, URL) pair.

Definition at line 1439 of file kicad_git_common.cpp.

References m_repo, name, and KIGIT::StripEmbeddedUserinfo().

Referenced by BOOST_AUTO_TEST_CASE().

◆ GetRepo()

◆ GetSSHKey()

wxString KIGIT_COMMON::GetSSHKey ( ) const

The key the project was set up with, even when its file is gone, otherwise the first key offered.

Empty when none is known.

Definition at line 1948 of file kicad_git_common.cpp.

References m_credentialsMutex, m_projectSSHKey, and m_publicKeys.

◆ GetStashDetail()

KIGIT_STASH_DETAIL KIGIT_COMMON::GetStashDetail ( const wxString & aId) const

◆ GetStashes()

◆ GetTagDetail()

KIGIT_TAG_DETAIL KIGIT_COMMON::GetTagDetail ( const wxString & aName) const

Definition at line 1534 of file kicad_git_common.cpp.

References KIGIT::DecodeRepoText(), m_repo, and message.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GetTags().

◆ GetTags()

std::vector< KIGIT_TAG_INFO > KIGIT_COMMON::GetTags ( ) const

◆ GetUnmergedCommitCount()

std::optional< size_t > KIGIT_COMMON::GetUnmergedCommitCount ( const wxString & aBranch) const

Commits in aBranch that HEAD does not contain. No value when either cannot be read.

Definition at line 1001 of file kicad_git_common.cpp.

References compareRefs(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ GetUsername()

◆ GetWorkingTreeLineStats()

std::pair< int, int > KIGIT_COMMON::GetWorkingTreeLineStats ( const std::set< wxString > & aPaths) const

◆ HasLocalCommits()

bool KIGIT_COMMON::HasLocalCommits ( ) const

True when HEAD has commits its upstream does not, or has no upstream yet.

False for a detached or unborn HEAD.

Definition at line 940 of file kicad_git_common.cpp.

References UpstreamStatus().

Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ HasPushAndPullRemote()

◆ HasUncommittedTrackedChanges()

bool KIGIT_COMMON::HasUncommittedTrackedChanges ( bool * aReadOk = nullptr) const

◆ IsHeadDetached()

bool KIGIT_COMMON::IsHeadDetached ( ) const

True when HEAD points at a commit rather than a branch, as after checking out a tag.

Definition at line 948 of file kicad_git_common.cpp.

References m_repo.

Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PANEL_GIT_BRANCHES::onForcePush(), PANEL_GIT_HISTORY::onRestoreVersion(), GIT_COMMIT_PANE::RefreshFileList(), and UpstreamStatus().

◆ IsHeadUnborn()

bool KIGIT_COMMON::IsHeadUnborn ( ) const

True while the repository has no commits, so HEAD names a branch that does not exist yet.

Definition at line 1471 of file kicad_git_common.cpp.

References m_repo.

Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), moveToNewBranch(), and StartUnbornBranch().

◆ IsOperationInProgress()

bool KIGIT_COMMON::IsOperationInProgress ( ) const

True while a merge, rebase, cherry-pick or revert is in progress, which refuses commits.

Definition at line 1671 of file kicad_git_common.cpp.

References m_repo.

Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::RefreshFileList(), and LIBGIT_BACKEND::UndoLastCommit().

◆ IsPathConflicted()

bool KIGIT_COMMON::IsPathConflicted ( const wxString & aPath) const

True while aPath is one of the files a merge or rebase stopped on.

Definition at line 1651 of file kicad_git_common.cpp.

References index, and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::discardFile(), and KIGIT::IgnoreState().

◆ IsPathInHead()

bool KIGIT_COMMON::IsPathInHead ( const wxString & aPath)

True when the working directory relative path exists in the HEAD commit's tree.

Definition at line 1645 of file kicad_git_common.cpp.

References GetGitBackend(), GIT_BACKEND::IsPathInHead(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::discardFile(), and MaterializeWorkingFile().

◆ IsPullRebaseConfigured()

bool KIGIT_COMMON::IsPullRebaseConfigured ( ) const

True when the repository is set to rebase rather than merge when getting changes.

Definition at line 954 of file kicad_git_common.cpp.

References config, and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::resolvePullConflicts().

◆ IsShuttingDown()

bool KIGIT_COMMON::IsShuttingDown ( ) const
inline

Background timers ask this before starting work of their own.

Definition at line 684 of file kicad_git_common.h.

References m_operationMutex, and m_shutdown.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), GetDifferentFiles(), and GetRecentCommits().

◆ LockAction()

◆ NewCancelToken()

static CANCEL_TOKEN KIGIT_COMMON::NewCancelToken ( )
inlinestatic

◆ NotifyRefreshListeners()

void KIGIT_COMMON::NotifyRefreshListeners ( )

◆ OperationInProgress()

GitOperation KIGIT_COMMON::OperationInProgress ( ) const

Which operation that is, so the panel can name it.

Definition at line 1677 of file kicad_git_common.cpp.

References CherryPick, m_repo, Merge, None, Other, Rebase, and Revert.

Referenced by BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::RefreshFileList().

◆ ParseRemoteURL()

◆ rebuildPublicKeysUnlocked()

void KIGIT_COMMON::rebuildPublicKeysUnlocked ( )
private

Rebuild m_publicKeys as the project key, when offerable, then the key that last connected to m_remote, then the discovered keys, and restart from the first.

The caller holds m_credentialsMutex.

Definition at line 2048 of file kicad_git_common.cpp.

References KIGIT::IsOfferableSSHKey(), KIGIT::IsSameSSHKey(), m_discoveredKeys, m_nextPublicKey, m_projectSSHKey, m_publicKeys, m_remote, KIGIT::RememberedSSHKey(), and traceGit.

Referenced by ApplyPromptedCredentials(), ResetNextKey(), SetSSHKey(), SyncRemoteUrl(), and updatePublicKeys().

◆ RememberWorkingSSHKey()

void KIGIT_COMMON::RememberWorkingSSHKey ( const KIGIT_AUTH_ATTEMPT & aAttempt)

Remember the key that connected for aAttempt, so the next connection offers it first.

Definition at line 2088 of file kicad_git_common.cpp.

References KIGIT_AUTH_ATTEMPT::connType, GetRemote(), GIT_CONN_SSH, KIGIT_AUTH_ATTEMPT::keysTried, and KIGIT::RememberSSHKey().

◆ remoteNameWithoutUpstream()

wxString KIGIT_COMMON::remoteNameWithoutUpstream ( ) const
private

Remote to use when HEAD names no upstream, empty when several remotes leave it ambiguous.

Definition at line 1838 of file kicad_git_common.cpp.

References GetLastGitError(), m_repo, and traceGit.

Referenced by GetRemotename().

◆ RemoveRefreshListener()

void KIGIT_COMMON::RemoveRefreshListener ( void * aOwner)

◆ RemoveRemote()

bool KIGIT_COMMON::RemoveRemote ( const wxString & aName)

◆ ResetNextKey()

void KIGIT_COMMON::ResetNextKey ( )

Start the next attempt from the first key, with the key that last connected to the current remote moved up.

Definition at line 2081 of file kicad_git_common.cpp.

References m_credentialsMutex, and rebuildPublicKeysUnlocked().

Referenced by BOOST_AUTO_TEST_CASE().

◆ RestoreVersion()

RestoreResult KIGIT_COMMON::RestoreVersion ( const wxString & aCommitHash,
KIGIT_ERROR_MESSAGE & aError )

Restore the project as it was at aCommitHash, recorded as a new commit on top of the current head.

Only the session's project folder is restored. A failure leaves its reason in aError's details, and a summary only when the next step is known.

Definition at line 1633 of file kicad_git_common.cpp.

References GetGitBackend(), and GIT_BACKEND::RestoreVersion().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SecretRead()

bool KIGIT_COMMON::SecretRead ( ) const
inline

False while the keyring has not been read for the current remote.

Definition at line 342 of file kicad_git_common.h.

References m_credentialsMutex, and secretReadLocked().

Referenced by KIGIT::AnswerTransferFailure(), and PROJECT_TREE_PANE::onGitRemoteSettings().

◆ secretReadLocked()

bool KIGIT_COMMON::secretReadLocked ( ) const
inlineprivate

SecretRead() for a caller already holding m_credentialsMutex.

Definition at line 771 of file kicad_git_common.h.

References GIT_CONN_LOCAL, m_connType, m_remote, and m_secretFetched.

Referenced by SecretRead().

◆ SetAcceptedSSHKey()

void KIGIT_COMMON::SetAcceptedSSHKey ( const wxString & aKey)

Definition at line 1983 of file kicad_git_common.cpp.

References m_acceptedSSHKey, and m_credentialsMutex.

◆ SetAttachError()

void KIGIT_COMMON::SetAttachError ( const wxString & aError,
const wxString & aTrustCommand = wxEmptyString )
inline

Why binding a repository last failed, for the panels to show. Empty on success.

Definition at line 593 of file kicad_git_common.h.

References m_attachError, and m_attachTrustCommand.

◆ SetConnType()

void KIGIT_COMMON::SetConnType ( GIT_CONN_TYPE aConnType)

For a remote whose address names no transport, the user picks one in the prompt.

Definition at line 2235 of file kicad_git_common.cpp.

References m_connType, and m_credentialsMutex.

◆ SetPassword()

void KIGIT_COMMON::SetPassword ( const wxString & aPassword)
inline

◆ SetProjectDir()

void KIGIT_COMMON::SetProjectDir ( const wxString & aProjectDir)
inline

Keep symlinks in the repository path so Git status paths match the project tree.

Definition at line 581 of file kicad_git_common.h.

References m_projectDir.

Referenced by PROJECT_TREE_PANE::onGitInitializeProject().

◆ SetRemote()

◆ SetRemoteUrl()

bool KIGIT_COMMON::SetRemoteUrl ( const wxString & aName,
const wxString & aUrl )

◆ SetRepo()

◆ SetShuttingDown()

void KIGIT_COMMON::SetShuttingDown ( bool aCancel)
inline

Stop the operation running now and keep later ones from starting.

Definition at line 691 of file kicad_git_common.h.

References m_activeCancel, m_operationMutex, and m_shutdown.

Referenced by BOOST_AUTO_TEST_CASE(), and PROJECT_TREE_PANE::onGitInitializeProject().

◆ SetSSHKey()

void KIGIT_COMMON::SetSSHKey ( const wxString & aSSHKey)

◆ SetUserConfig()

bool KIGIT_COMMON::SetUserConfig ( const wxString & aName,
const wxString & aEmail )

◆ SetUsername()

void KIGIT_COMMON::SetUsername ( const wxString & aUsername)
inline

◆ SSHPortFor()

int KIGIT_COMMON::SSHPortFor ( const wxString & aHost) const

The SSH port the session's remote names for aHost, 22 when it names none, or -1 when the remote is on another host or its port is not valid.

Definition at line 2024 of file kicad_git_common.cpp.

References m_credentialsMutex, m_hostname, and m_port.

◆ StartUnbornBranch()

bool KIGIT_COMMON::StartUnbornBranch ( const wxString & aName)

Point HEAD at a branch that does not exist yet, so the first commit creates it.

Only meaningful while the repository has no commits. With no commit to start it at, a branch cannot be created any other way.

Definition at line 1477 of file kicad_git_common.cpp.

References KIGIT::BranchNameError(), IsHeadUnborn(), and m_repo.

Referenced by BOOST_AUTO_TEST_CASE(), and moveToNewBranch().

◆ StashApply()

bool KIGIT_COMMON::StashApply ( size_t aIndex)

◆ StashDrop()

bool KIGIT_COMMON::StashDrop ( size_t aIndex)

◆ StashPop()

bool KIGIT_COMMON::StashPop ( size_t aIndex)

◆ StashSave()

bool KIGIT_COMMON::StashSave ( const wxString & aMessage)

Set the uncommitted tracked changes aside as a new stash, as git stash push would.

Definition at line 1504 of file kicad_git_common.cpp.

References GetGitBackend(), m_repo, and GIT_BACKEND::StashSave().

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ SyncRemoteUrl()

void KIGIT_COMMON::SyncRemoteUrl ( const wxString & aRawUrl)

Bind the session to the URL a transfer is about to connect to.

An unchanged URL keeps the session credentials, so a password corrected in the prompt outlives a stale one in the URL. A changed URL replaces the username and password with its own, clearing any it lacks.

Definition at line 2171 of file kicad_git_common.cpp.

References KIGIT_COMMON::REMOTE_URL::connType, KIGIT_COMMON::REMOTE_URL::hostname, m_acceptedSSHKey, m_connType, m_credentialsMutex, m_hostname, m_password, m_port, m_publicKeysHost, m_remote, m_secretFetched, m_urlUsername, m_username, ParseRemoteURL(), KIGIT_COMMON::REMOTE_URL::password, KIGIT_COMMON::REMOTE_URL::port, rebuildPublicKeysUnlocked(), updatePublicKeys(), KIGIT_COMMON::REMOTE_URL::url, and KIGIT_COMMON::REMOTE_URL::username.

Referenced by fetchRemote(), FollowRewrittenUrl(), LIBGIT_BACKEND::Push(), resolveMissingRemote(), SetRemote(), and UpdateCurrentBranchInfo().

◆ Transfers()

GIT_TRANSFER_BUSY & KIGIT_COMMON::Transfers ( )
inline

The transfers running on this repository, which every window shows and may cancel. UI thread only.

Definition at line 725 of file kicad_git_common.h.

References m_transfers.

◆ TryLockAction()

std::unique_lock< std::mutex > KIGIT_COMMON::TryLockAction ( )
inline

Definition at line 704 of file kicad_git_common.h.

References m_gitActionMutex.

Referenced by KIGIT::TryLockAction().

◆ TryLockActionFor()

std::unique_lock< std::mutex > KIGIT_COMMON::TryLockActionFor ( std::chrono::milliseconds aWait)

TryLockAction that keeps trying for aWait before giving up.

For the UI thread, where a blocking LockAction could wait out a whole network timeout.

Definition at line 2035 of file kicad_git_common.cpp.

References m_gitActionMutex.

Referenced by resolveMissingRemote(), and KIGIT::WaitForActionLock().

◆ updateConnectionType()

void KIGIT_COMMON::updateConnectionType ( )
private

Definition at line 2622 of file kicad_git_common.cpp.

References m_credentialsMutex, and updateConnectionTypeUnlocked().

◆ updateConnectionTypeUnlocked()

void KIGIT_COMMON::updateConnectionTypeUnlocked ( )
private

◆ UpdateCurrentBranchInfo()

void KIGIT_COMMON::UpdateCurrentBranchInfo ( )

◆ updatePublicKeys()

◆ UpstreamStatus()

std::optional< KIGIT_UPSTREAM_STATUS > KIGIT_COMMON::UpstreamStatus ( ) const

The current branch against its upstream.

No value for a detached or unborn HEAD, or when git fails, so a missing upstream is not mistaken for an error.

Definition at line 971 of file kicad_git_common.cpp.

References compareRefs(), IsHeadDetached(), m_repo, and result.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), HasLocalCommits(), and GIT_COMMIT_PANE::RefreshFileList().

Friends And Related Symbol Documentation

◆ GIT_CLONE_HANDLER

friend class GIT_CLONE_HANDLER
friend

Definition at line 757 of file kicad_git_common.h.

References GIT_CLONE_HANDLER.

Referenced by GIT_CLONE_HANDLER.

◆ GIT_PULL_HANDLER

friend class GIT_PULL_HANDLER
friend

Definition at line 756 of file kicad_git_common.h.

References GIT_PULL_HANDLER.

Referenced by GIT_PULL_HANDLER.

◆ GIT_PUSH_HANDLER

friend class GIT_PUSH_HANDLER
friend

Definition at line 755 of file kicad_git_common.h.

References GIT_PUSH_HANDLER.

Referenced by GIT_PUSH_HANDLER.

◆ LIBGIT_BACKEND

friend class LIBGIT_BACKEND
friend

Definition at line 758 of file kicad_git_common.h.

References compareRefs(), and LIBGIT_BACKEND.

Referenced by LIBGIT_BACKEND.

Member Data Documentation

◆ ACTION_LOCK_WAIT

std::chrono::milliseconds KIGIT_COMMON::ACTION_LOCK_WAIT { 2000 }
staticconstexpr

Long enough for a status read to finish, short enough that a window does not look hung.

Definition at line 710 of file kicad_git_common.h.

Referenced by GIT_COMMIT_PANE::finishPullConflictPreparation(), PROJECT_TREE_PANE::onGitInitializeProject(), resolveMissingRemote(), and KIGIT::WaitForActionLock().

◆ m_acceptedSSHKey

wxString KIGIT_COMMON::m_acceptedSSHKey
private

◆ m_activeCancel

CANCEL_TOKEN KIGIT_COMMON::m_activeCancel
private

Definition at line 801 of file kicad_git_common.h.

Referenced by ActiveCancelToken(), and SetShuttingDown().

◆ m_attachError

wxString KIGIT_COMMON::m_attachError
protected

Definition at line 732 of file kicad_git_common.h.

Referenced by GetAttachError(), and SetAttachError().

◆ m_attachTrustCommand

wxString KIGIT_COMMON::m_attachTrustCommand
protected

Definition at line 733 of file kicad_git_common.h.

Referenced by GetAttachTrustCommand(), and SetAttachError().

◆ m_connType

◆ m_credentialsMutex

std::mutex KIGIT_COMMON::m_credentialsMutex
mutableprotected

Serializes the credential fields between the UI thread and the authentication callback's worker thread.

wxString is copy on write, so a read racing a write corrupts it. Separate from m_gitActionMutex, which the worker holds while the callback runs.

Definition at line 748 of file kicad_git_common.h.

Referenced by ApplyPromptedCredentials(), FollowRewrittenUrl(), GetAcceptedSSHKey(), GetConnType(), GetCredentialIdentity(), GetFirstOfferedSSHKey(), GetNextPublicKey(), GetPassword(), GetRemote(), GetSSHKey(), GetUsername(), ResetNextKey(), SecretRead(), SetAcceptedSSHKey(), SetConnType(), SetPassword(), SetRemote(), SetSSHKey(), SetUsername(), SSHPortFor(), SyncRemoteUrl(), updateConnectionType(), and updatePublicKeys().

◆ m_discoveredKeys

std::vector<wxString> KIGIT_COMMON::m_discoveredKeys
private

Definition at line 790 of file kicad_git_common.h.

Referenced by KIGIT_COMMON(), rebuildPublicKeysUnlocked(), and updatePublicKeys().

◆ m_gitActionMutex

std::mutex KIGIT_COMMON::m_gitActionMutex
protected

Definition at line 743 of file kicad_git_common.h.

Referenced by KIGIT_COMMON(), LockAction(), TryLockAction(), and TryLockActionFor().

◆ m_hostname

wxString KIGIT_COMMON::m_hostname
protected

◆ m_nextPublicKey

int KIGIT_COMMON::m_nextPublicKey
private

◆ m_operationMutex

std::mutex KIGIT_COMMON::m_operationMutex
mutableprivate

Guarded together, so a shutdown cannot miss an operation registering itself at the same moment.

The token is null when nothing is running.

Definition at line 800 of file kicad_git_common.h.

Referenced by ActiveCancelToken(), IsShuttingDown(), and SetShuttingDown().

◆ m_password

wxString KIGIT_COMMON::m_password
protected

◆ m_port

int KIGIT_COMMON::m_port = 0
protected

◆ m_projectDir

wxString KIGIT_COMMON::m_projectDir
protected

Definition at line 730 of file kicad_git_common.h.

Referenced by GetProjectDir(), KIGIT_COMMON(), and SetProjectDir().

◆ m_projectPath

wxString KIGIT_COMMON::m_projectPath
protected

Definition at line 731 of file kicad_git_common.h.

Referenced by GetProjectPrefix(), KIGIT_COMMON(), and KIGIT_COMMON().

◆ m_projectSSHKey

wxString KIGIT_COMMON::m_projectSSHKey
private

◆ m_publicKeys

std::vector<wxString> KIGIT_COMMON::m_publicKeys
private

◆ m_publicKeysHost

wxString KIGIT_COMMON::m_publicKeysHost
private

Definition at line 792 of file kicad_git_common.h.

Referenced by KIGIT_COMMON(), SyncRemoteUrl(), and updatePublicKeys().

◆ m_refreshListeners

std::vector<std::pair<void*, std::function<void()> > > KIGIT_COMMON::m_refreshListeners
protected

◆ m_remote

◆ m_repo

◆ m_secretFetched

◆ m_shutdown

bool KIGIT_COMMON::m_shutdown = false
private

Definition at line 802 of file kicad_git_common.h.

Referenced by IsShuttingDown(), and SetShuttingDown().

◆ m_transfers

GIT_TRANSFER_BUSY KIGIT_COMMON::m_transfers
protected

Definition at line 752 of file kicad_git_common.h.

Referenced by Transfers().

◆ m_urlUsername

wxString KIGIT_COMMON::m_urlUsername
protected

Definition at line 737 of file kicad_git_common.h.

Referenced by KIGIT_COMMON(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().

◆ m_username


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