|
KiCad PCB EDA Suite
|
The project's git session. More...
#include <kicad_git_common.h>
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 () |
| 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. | |
| 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. | |
| std::atomic< unsigned > & | TestedTypes () |
| bool | HasLocalCommits () const |
| True when HEAD has commits its upstream does not, or has no upstream yet. | |
| bool | HasUpstreamCommits () const |
| True when the upstream branch has commits the current branch does not. | |
| 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". | |
| 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 () |
| wxString | GetNextPublicKey () |
| By value, so the caller never holds a pointer into the vector. | |
| void | SetRemote (const wxString &aRemote) |
| wxString | GetRemote () const |
| int | HandleSSHKeyAuthentication (git_cred **aOut, const wxString &aUsername, KIGIT_AUTH_ATTEMPT &aAttempt) |
| Offer the agent's keys once, then the next key file, recording in aAttempt which file was offered. | |
| int | HandlePlaintextAuthentication (git_cred **aOut, const wxString &aUsername) |
| int | HandleSSHAgentAuthentication (git_cred **aOut, const wxString &aUsername) |
| 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 () |
Static Public Member Functions | |
| static REMOTE_URL | ParseRemoteURL (const wxString &aURL) |
| 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::atomic< unsigned > | m_testedTypes |
| 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 |
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 |
| 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 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 |
| 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 |
Static Private Attributes | |
| static const unsigned | KIGIT_CREDENTIAL_SSH_AGENT = 1u << ( sizeof( unsigned ) * 8 - 1 ) |
Friends | |
| class | GIT_PUSH_HANDLER |
| class | GIT_PULL_HANDLER |
| class | GIT_CLONE_HANDLER |
| class | LIBGIT_BACKEND |
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 229 of file kicad_git_common.h.
| 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 614 of file kicad_git_common.h.
|
strong |
| Enumerator | |
|---|---|
| GIT_CONN_HTTPS | |
| GIT_CONN_SSH | |
| GIT_CONN_LOCAL | |
| GIT_CONN_LAST | |
Definition at line 289 of file kicad_git_common.h.
|
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 275 of file kicad_git_common.h.
| 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 59 of file kicad_git_common.cpp.
References GIT_CONN_LOCAL, git_repository, m_connType, m_nextPublicKey, m_projectPath, m_repo, m_secretFetched, and m_testedTypes.
Referenced by GIT_COMMIT_HANDLER::GIT_COMMIT_HANDLER(), KIGIT_COMMON(), and KIGIT_COMMON::OPERATION_GUARD::OPERATION_GUARD().
| KIGIT_COMMON::KIGIT_COMMON | ( | const KIGIT_COMMON & | aOther | ) |
Definition at line 69 of file kicad_git_common.cpp.
References KIGIT_COMMON(), m_connType, m_discoveredKeys, m_gitActionMutex, m_hostname, m_nextPublicKey, m_password, m_port, m_projectDir, m_projectPath, m_projectSSHKey, m_publicKeys, m_publicKeysHost, m_remote, m_repo, m_secretFetched, m_testedTypes, m_urlUsername, and m_username.
| KIGIT_COMMON::~KIGIT_COMMON | ( | ) |
Definition at line 95 of file kicad_git_common.cpp.
| bool KIGIT_COMMON::AbandonOperation | ( | wxString & | aError | ) |
Drop that operation and return to the last commit. The caller holds the action lock.
Definition at line 1658 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().
|
inlineprivate |
Definition at line 731 of file kicad_git_common.h.
References m_activeCancel, and m_operationMutex.
Referenced by GetRecentCommits().
| void KIGIT_COMMON::AddRefreshListener | ( | void * | aOwner, |
| std::function< void()> | aCallback ) |
Definition at line 1679 of file kicad_git_common.cpp.
References m_refreshListeners.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| bool KIGIT_COMMON::AddRemote | ( | const wxString & | aName, |
| const wxString & | aUrl ) |
Definition at line 1568 of file kicad_git_common.cpp.
References GIT_BACKEND::AddRemote(), GetGitBackend(), and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_GIT_REMOTES::onAddRemote().
| 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 1928 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_testedTypes, 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().
| bool KIGIT_COMMON::CheckoutTag | ( | const wxString & | aName | ) |
Definition at line 1562 of file kicad_git_common.cpp.
References GIT_BACKEND::CheckoutTag(), GetGitBackend(), and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_GIT_TAGS::onCheckoutTag().
|
private |
Count commits unique to aBranch and aBase. No value if the history cannot be read.
Definition at line 861 of file kicad_git_common.cpp.
References KIGIT_AHEAD_BEHIND::ahead, KIGIT_AHEAD_BEHIND::behind, m_repo, and result.
Referenced by GetBranchDetail(), GetUnmergedCommitCount(), HasLocalCommits(), HasUpstreamCommits(), and LIBGIT_BACKEND.
| bool KIGIT_COMMON::CreateBranch | ( | const wxString & | aName, |
| const wxString & | aFrom = wxEmptyString ) |
Definition at line 1448 of file kicad_git_common.cpp.
References KIGIT::BranchNameError(), GIT_BACKEND::CreateBranch(), GetGitBackend(), 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(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), moveToNewBranch(), and PANEL_GIT_BRANCHES::onNewBranch().
| 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 1671 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(), and BOOST_AUTO_TEST_CASE().
| bool KIGIT_COMMON::CreateTag | ( | const wxString & | aName, |
| const wxString & | aMessage = wxEmptyString ) |
Definition at line 1487 of file kicad_git_common.cpp.
References GIT_BACKEND::CreateTag(), GetGitBackend(), 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 PANEL_GIT_TAGS::onNewTag().
| bool KIGIT_COMMON::DeleteBranch | ( | const wxString & | aName | ) |
Definition at line 1457 of file kicad_git_common.cpp.
References GIT_BACKEND::DeleteBranch(), GetGitBackend(), and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), dropNewBranch(), and moveToNewBranch().
| bool KIGIT_COMMON::DeleteTag | ( | const wxString & | aName | ) |
Definition at line 1556 of file kicad_git_common.cpp.
References GIT_BACKEND::DeleteTag(), GetGitBackend(), and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), and PANEL_GIT_TAGS::onDeleteTag().
| 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 1598 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().
| 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 2101 of file kicad_git_common.cpp.
References m_credentialsMutex, m_password, m_secretFetched, m_username, and SyncRemoteUrl().
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick().
|
inline |
Definition at line 564 of file kicad_git_common.h.
References m_attachError.
|
inline |
The command that trusts a repository another user owns, when that is why attaching failed.
Definition at line 567 of file kicad_git_common.h.
References m_attachTrustCommand.
| KIGIT_BRANCH_DETAIL KIGIT_COMMON::GetBranchDetail | ( | const wxString & | aBranch | ) | const |
Definition at line 599 of file kicad_git_common.cpp.
References compareRefs(), KIGIT::DecodeRepoText(), m_repo, and message.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| 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 524 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().
| KIGIT_COMMIT_DETAIL KIGIT_COMMON::GetCommitDetail | ( | const wxString & | aHash | ) | const |
Definition at line 1185 of file kicad_git_common.cpp.
References KIGIT_COMMIT_FILE::added, KIGIT_COMMIT_FILE::binary, KIGIT::DecodeRepoText(), delta, m_repo, message, KIGIT_COMMIT_FILE::oldPath, KIGIT_COMMIT_FILE::path, KIGIT_COMMIT_FILE::removed, and KIGIT_COMMIT_FILE::status.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType | ( | ) | const |
Definition at line 2123 of file kicad_git_common.cpp.
References m_connType, and m_credentialsMutex.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| KIGIT_COMMON::CREDENTIAL_IDENTITY KIGIT_COMMON::GetCredentialIdentity | ( | ) | const |
Definition at line 1921 of file kicad_git_common.cpp.
References m_connType, m_credentialsMutex, m_remote, and m_username.
Referenced by KIGIT::PromptForCredentials().
| wxString KIGIT_COMMON::GetCurrentBranchName | ( | ) | const |
Definition at line 131 of file kicad_git_common.cpp.
References m_repo, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PANEL_GIT_BRANCHES::onForcePush(), GIT_ADVANCED_DIALOG::populateTopBar(), TEXT_EVAL_VCS::ReadBranch(), GIT_COMMIT_PANE::RefreshFileList(), and GIT_COMMIT_PANE::submitPush().
| 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 724 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().
| 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 1904 of file kicad_git_common.cpp.
References KIGIT::IsOfferableSSHKey(), m_credentialsMutex, m_projectSSHKey, and m_publicKeys.
Referenced by initialSSHKey().
| wxString KIGIT_COMMON::GetGitRootDirectory | ( | ) | const |
Definition at line 2015 of file kicad_git_common.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::discardFile(), and GIT_ADVANCED_DIALOG::populateTopBar().
| 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().
| wxString KIGIT_COMMON::GetLastCommitMessage | ( | ) | const |
Definition at line 221 of file kicad_git_common.cpp.
References KIGIT::DecodeRepoText(), m_repo, and message.
Referenced by GIT_COMMIT_PANE::BeginAmend().
| wxDateTime KIGIT_COMMON::GetLastFetchTime | ( | ) | const |
Definition at line 339 of file kicad_git_common.cpp.
References m_repo.
Referenced by BOOST_AUTO_TEST_CASE().
|
static |
libgit2's last message, without credentials from any URL it quotes, so it is safe to show or trace.
Definition at line 2159 of file kicad_git_common.cpp.
References KIGIT::StripEmbeddedUserinfo().
Referenced by LIBGIT_BACKEND::AbandonOperation(), HISTORY_LOCK_MANAGER::acquireIndexLock(), KIGIT_ERRORS::AddGitError(), adoptRemoteHistory(), COMMIT_STAGING::Begin(), COMMIT_STAGING::BuildTree(), KIGIT::CompareRefs(), LIBGIT_BACKEND::CreateBranch(), LIBGIT_BACKEND::CreateMergedCommit(), credentials_cb(), describeSignatureFailure(), LIBGIT_BACKEND::DiscardChanges(), ensureMergeDriverConfig(), GetBranches(), LIBGIT_BACKEND::GetConfigString(), LIBGIT_BACKEND::GetCurrentBranchName(), getDefaultAuthorAndEmail(), GetDifferentFiles(), LIBGIT_BACKEND::GetFileStatus(), GetProjectDirs(), GetRemotename(), LIBGIT_BACKEND::GetRepositoryForFile(), LIBGIT_BACKEND::handleFastForward(), HandleSSHAgentAuthentication(), HandleSSHKeyAuthentication(), LIBGIT_BACKEND::hasUnstagedChanges(), LIBGIT_BACKEND::Init(), LIBGIT_BACKEND::InitializeRepository(), moveToNewBranch(), HISTORY_LOCK_MANAGER::openRepository(), publishPreparedCommit(), rebaseOnto(), KIGIT::RegisterMergeDriver(), remoteNameWithoutUpstream(), reportRemoteLookupFailure(), KIGIT::ResolveRefToTree(), LIBGIT_BACKEND::RestoreVersion(), setConfigIfMissing(), PROJECT_TREE_PANE::switchGitBranch(), SwitchProjectToBranch(), and LIBGIT_BACKEND::SwitchToBranch().
|
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 2171 of file kicad_git_common.cpp.
References info.
Referenced by LIBGIT_BACKEND::Clone(), DIALOG_GIT_REPOSITORY::OnTestClick(), LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::Push(), and LIBGIT_BACKEND::SetupRemote().
| 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 1664 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(), and GIT_COMMIT_PANE::resolvePullConflicts().
| wxString KIGIT_COMMON::GetNextPublicKey | ( | ) |
By value, so the caller never holds a pointer into the vector.
Definition at line 1998 of file kicad_git_common.cpp.
References KIGIT::IsOfferableSSHKey(), m_credentialsMutex, m_nextPublicKey, and m_publicKeys.
Referenced by BOOST_AUTO_TEST_CASE(), and HandleSSHKeyAuthentication().
| wxString KIGIT_COMMON::GetPassword | ( | ) |
Definition at line 180 of file kicad_git_common.cpp.
References KIPLATFORM::SECRETS::GetSecret(), GIT_CONN_LOCAL, m_connType, m_credentialsMutex, m_password, m_remote, m_secretFetched, and m_username.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), HandlePlaintextAuthentication(), HandleSSHKeyAuthentication(), and PROJECT_TREE_PANE::onGitRemoteSettings().
| 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().
| 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
Definition at line 655 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), and KICAD_MANAGER_CONTROL::NewFromRepository().
| 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::PROJECT_GIT_UTILS::LfsRefusal(), KIGIT::PROJECT_GIT_UTILS::ProjectUsesGitLfs(), and LIBGIT_BACKEND::RestoreVersion().
| std::vector< wxString > KIGIT_COMMON::GetRecentCommitMessages | ( | size_t | aMax | ) | const |
Definition at line 990 of file kicad_git_common.cpp.
References KIGIT::DecodeRepoText(), m_repo, message, and text.
Referenced by BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::RefreshFileList().
| std::vector< KIGIT_COMMIT_INFO > KIGIT_COMMON::GetRecentCommits | ( | size_t | aMax = 50, |
| const KIGIT_HISTORY_FILTER & | aFilter = {} ) const |
Definition at line 1081 of file kicad_git_common.cpp.
References ActiveCancelToken(), KIGIT_HISTORY_FILTER::branch, cancel, KIGIT::DecodeRepoText(), info, IsShuttingDown(), m_repo, KIGIT_HISTORY_FILTER::path, path, and KIGIT_HISTORY_FILTER::search.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PANEL_GIT_HISTORY::onHistoryScrollTick(), and PANEL_GIT_HISTORY::Populate().
|
inline |
Definition at line 592 of file kicad_git_common.h.
References m_credentialsMutex, and m_remote.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), LIBGIT_BACKEND::Clone(), and resolveMissingRemote().
| wxString KIGIT_COMMON::GetRemotename | ( | ) | const |
Definition at line 1836 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, remoteNameWithoutUpstream(), and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), GetRemoteNameOrDefault(), and UpdateCurrentBranchInfo().
| 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 1772 of file kicad_git_common.cpp.
References GetRemotename().
Referenced by adoptRemoteHistory(), HasPushAndPullRemote(), PANEL_GIT_BRANCHES::onForcePush(), LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::PerformPull(), LIBGIT_BACKEND::Push(), and resolveMissingRemote().
| std::vector< std::pair< wxString, wxString > > KIGIT_COMMON::GetRemotes | ( | ) | const |
Returns every remote as a (name, URL) pair.
Definition at line 1398 of file kicad_git_common.cpp.
References m_repo, name, and KIGIT::StripEmbeddedUserinfo().
Referenced by BOOST_AUTO_TEST_CASE().
| git_repository * KIGIT_COMMON::GetRepo | ( | ) | const |
Definition at line 99 of file kicad_git_common.cpp.
References git_repository, and m_repo.
Referenced by LIBGIT_BACKEND::Amend(), amendRefusal(), GIT_COMMIT_PANE::BeginAmend(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ChangedTrackedFilesOutsideProject(), LIBGIT_BACKEND::Commit(), GIT_COMMIT_PANE::doCommit(), PROJECT_TREE_PANE::gitRepo(), KIGIT::PROJECT_GIT_UTILS::LfsRefusal(), MaterializeCommitFile(), MaterializeWorkingFile(), KICAD_MANAGER_CONTROL::NewFromRepository(), PROJECT_TREE_PANE::onGitRemoteSettings(), KIGIT::PROJECT_GIT_UTILS::ProjectUsesGitLfs(), KIGIT::ReadGitIdentity(), ReadGitWorktreeStatus(), resolveMissingRemote(), and LIBGIT_BACKEND::RestoreVersion().
| 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 1893 of file kicad_git_common.cpp.
References m_credentialsMutex, m_projectSSHKey, and m_publicKeys.
| KIGIT_STASH_DETAIL KIGIT_COMMON::GetStashDetail | ( | const wxString & | aId | ) | const |
Definition at line 359 of file kicad_git_common.cpp.
References KIGIT::CollectDiffDeltas(), KIGIT::DecodeRepoText(), m_repo, message, and path.
Referenced by BOOST_AUTO_TEST_CASE().
| std::vector< KIGIT_STASH_INFO > KIGIT_COMMON::GetStashes | ( | ) | const |
Definition at line 1338 of file kicad_git_common.cpp.
References m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), 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().
| KIGIT_TAG_DETAIL KIGIT_COMMON::GetTagDetail | ( | const wxString & | aName | ) | const |
Definition at line 1493 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().
| std::vector< KIGIT_TAG_INFO > KIGIT_COMMON::GetTags | ( | ) | const |
Definition at line 1352 of file kicad_git_common.cpp.
References KIGIT::DecodeRepoText(), GetTagDetail(), info, and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| 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 964 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().
|
inline |
Definition at line 310 of file kicad_git_common.h.
References m_credentialsMutex, and m_username.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PROJECT_TREE_PANE::onGitRemoteSettings().
| std::pair< int, int > KIGIT_COMMON::GetWorkingTreeLineStats | ( | const std::set< wxString > & | aPaths | ) | const |
Definition at line 472 of file kicad_git_common.cpp.
References delta, m_repo, and path.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::RefreshFileList().
| int KIGIT_COMMON::HandlePlaintextAuthentication | ( | git_cred ** | aOut, |
| const wxString & | aUsername ) |
Definition at line 2585 of file kicad_git_common.cpp.
References GetPassword(), and m_testedTypes.
Referenced by credentials_cb().
| int KIGIT_COMMON::HandleSSHAgentAuthentication | ( | git_cred ** | aOut, |
| const wxString & | aUsername ) |
Definition at line 2596 of file kicad_git_common.cpp.
References GetLastGitError(), KIGIT_CREDENTIAL_SSH_AGENT, m_testedTypes, and traceGit.
Referenced by HandleSSHKeyAuthentication().
| int KIGIT_COMMON::HandleSSHKeyAuthentication | ( | git_cred ** | aOut, |
| const wxString & | aUsername, | ||
| KIGIT_AUTH_ATTEMPT & | aAttempt ) |
Offer the agent's keys once, then the next key file, recording in aAttempt which file was offered.
Definition at line 2543 of file kicad_git_common.cpp.
References KIGIT_AUTH_ATTEMPT::agentTried, GetLastGitError(), GetNextPublicKey(), GetPassword(), HandleSSHAgentAuthentication(), KIGIT_AUTH_ATTEMPT::keysTried, KIGIT_CREDENTIAL_SSH_AGENT, m_testedTypes, and traceGit.
Referenced by credentials_cb().
| 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 891 of file kicad_git_common.cpp.
References compareRefs(), IsHeadDetached(), m_repo, and result.
Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::RefreshFileList().
| bool KIGIT_COMMON::HasPushAndPullRemote | ( | ) | const |
Definition at line 1715 of file kicad_git_common.cpp.
References GetRemoteNameOrDefault(), m_repo, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), GIT_ADVANCED_DIALOG::onFetch(), PANEL_GIT_BRANCHES::onForcePush(), GIT_COMMIT_PANE::RefreshFileList(), and GIT_COMMIT_PANE::submitPush().
| bool KIGIT_COMMON::HasUncommittedTrackedChanges | ( | bool * | aReadOk = nullptr | ) | const |
Definition at line 243 of file kicad_git_common.cpp.
References m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and ReadGitWorktreeStatus().
| bool KIGIT_COMMON::HasUpstreamCommits | ( | ) | const |
True when the upstream branch has commits the current branch does not.
Definition at line 941 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(), BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::RefreshFileList().
| 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 918 of file kicad_git_common.cpp.
References m_repo.
Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), HasLocalCommits(), PANEL_GIT_BRANCHES::onForcePush(), PANEL_GIT_HISTORY::onRestoreVersion(), and GIT_COMMIT_PANE::RefreshFileList().
| 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 1430 of file kicad_git_common.cpp.
References m_repo.
Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), moveToNewBranch(), and StartUnbornBranch().
| bool KIGIT_COMMON::IsOperationInProgress | ( | ) | const |
True while a merge, rebase, cherry-pick or revert is in progress, which refuses commits.
Definition at line 1630 of file kicad_git_common.cpp.
References m_repo.
Referenced by amendRefusal(), BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::RefreshFileList().
| 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 1610 of file kicad_git_common.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::discardFile().
| bool KIGIT_COMMON::IsPathInHead | ( | const wxString & | aPath | ) |
True when the working directory relative path exists in the HEAD commit's tree.
Definition at line 1604 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().
| bool KIGIT_COMMON::IsPullRebaseConfigured | ( | ) | const |
True when the repository is set to rebase rather than merge when getting changes.
Definition at line 924 of file kicad_git_common.cpp.
References config, and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), and GIT_COMMIT_PANE::resolvePullConflicts().
|
inline |
Background timers ask this before starting work of their own.
Definition at line 654 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().
|
inline |
Definition at line 686 of file kicad_git_common.h.
References m_gitActionMutex.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), 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().
|
inlinestatic |
Definition at line 616 of file kicad_git_common.h.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and KIGIT_TRANSFER::Start().
| void KIGIT_COMMON::NotifyRefreshListeners | ( | ) |
Definition at line 1695 of file kicad_git_common.cpp.
References m_refreshListeners, and registered.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| GitOperation KIGIT_COMMON::OperationInProgress | ( | ) | const |
Which operation that is, so the panel can name it.
Definition at line 1636 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().
|
static |
Definition at line 2418 of file kicad_git_common.cpp.
References decodePercent(), findUserinfoAt(), GIT_CONN_HTTPS, GIT_CONN_SSH, parsePort(), parseScpAddress(), and result.
Referenced by PROJECT::AttachGitRepository(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DIALOG_GIT_CREDENTIALS::DIALOG_GIT_CREDENTIALS(), DIALOG_GIT_REPOSITORY::extractClipboardData(), DIALOG_GIT_REPOSITORY::GetUsername(), KICAD_MANAGER_CONTROL::NewFromRepository(), KIGIT::PromptForCredentials(), saveAcceptedRemoteSettings(), LIBGIT_BACKEND::SetupRemote(), SyncRemoteUrl(), DIALOG_GIT_REPOSITORY::updateAuthControls(), updateConnectionTypeUnlocked(), and DIALOG_GIT_REPOSITORY::updateURLData().
|
private |
Rebuild m_publicKeys as the project key, when offerable, then the discovered keys, and restart from the first.
The caller holds m_credentialsMutex.
Definition at line 1980 of file kicad_git_common.cpp.
References KIGIT::IsOfferableSSHKey(), KIGIT::IsSameSSHKey(), m_discoveredKeys, m_nextPublicKey, m_projectSSHKey, m_publicKeys, and traceGit.
Referenced by ApplyPromptedCredentials(), SetSSHKey(), and updatePublicKeys().
|
private |
Remote to use when HEAD names no upstream, empty when several remotes leave it ambiguous.
Definition at line 1783 of file kicad_git_common.cpp.
References GetLastGitError(), m_repo, and traceGit.
Referenced by GetRemotename().
| void KIGIT_COMMON::RemoveRefreshListener | ( | void * | aOwner | ) |
Definition at line 1685 of file kicad_git_common.cpp.
References m_refreshListeners.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
| bool KIGIT_COMMON::RemoveRemote | ( | const wxString & | aName | ) |
Definition at line 1580 of file kicad_git_common.cpp.
References GetGitBackend(), m_repo, and GIT_BACKEND::RemoveRemote().
Referenced by BOOST_AUTO_TEST_CASE(), and PANEL_GIT_REMOTES::onRemoveRemote().
|
inline |
Definition at line 569 of file kicad_git_common.h.
References m_credentialsMutex, and m_nextPublicKey.
Referenced by BOOST_AUTO_TEST_CASE().
| 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 1592 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().
|
inline |
Why binding a repository last failed, for the panels to show. Empty on success.
Definition at line 558 of file kicad_git_common.h.
References m_attachError, and m_attachTrustCommand.
| 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 2130 of file kicad_git_common.cpp.
References m_connType, and m_credentialsMutex.
|
inline |
Definition at line 329 of file kicad_git_common.h.
References m_credentialsMutex, m_password, and m_secretFetched.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::SetupRemote().
|
inline |
Keep symlinks in the repository path so Git status paths match the project tree.
Definition at line 546 of file kicad_git_common.h.
References m_projectDir.
Referenced by PROJECT_TREE_PANE::onGitInitializeProject().
|
inline |
Definition at line 578 of file kicad_git_common.h.
References m_credentialsMutex, m_password, m_remote, m_secretFetched, SyncRemoteUrl(), and updateConnectionTypeUnlocked().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PROJECT_TREE_PANE::onGitRemoteSettings(), DIALOG_GIT_REPOSITORY::OnTestClick(), GIT_CLONE_HANDLER::SetRemote(), and LIBGIT_BACKEND::SetupRemote().
| bool KIGIT_COMMON::SetRemoteUrl | ( | const wxString & | aName, |
| const wxString & | aUrl ) |
Definition at line 1574 of file kicad_git_common.cpp.
References GetGitBackend(), m_repo, and GIT_BACKEND::SetRemoteUrl().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_GIT_REMOTES::onEditRemote().
|
inline |
Definition at line 241 of file kicad_git_common.h.
References git_repository, and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), LIBGIT_BACKEND::Clone(), LIBGIT_BACKEND::InitializeRepository(), and KICAD_MANAGER_CONTROL::NewFromRepository().
|
inline |
Stop the operation running now and keep later ones from starting.
Definition at line 661 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().
| void KIGIT_COMMON::SetSSHKey | ( | const wxString & | aSSHKey | ) |
Definition at line 1880 of file kicad_git_common.cpp.
References m_credentialsMutex, m_projectSSHKey, and rebuildPublicKeysUnlocked().
Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::SetupRemote().
| bool KIGIT_COMMON::SetUserConfig | ( | const wxString & | aName, |
| const wxString & | aEmail ) |
Definition at line 1586 of file kicad_git_common.cpp.
References GetGitBackend(), m_repo, and GIT_BACKEND::SetUserConfig().
Referenced by BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().
|
inline |
Definition at line 322 of file kicad_git_common.h.
References m_credentialsMutex, m_secretFetched, and m_username.
Referenced by BOOST_AUTO_TEST_CASE(), PROJECT_TREE_PANE::onGitRemoteSettings(), DIALOG_GIT_REPOSITORY::OnTestClick(), and LIBGIT_BACKEND::SetupRemote().
| 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 1956 of file kicad_git_common.cpp.
References m_credentialsMutex, m_hostname, and m_port.
Referenced by certificate_check_cb().
| 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 1436 of file kicad_git_common.cpp.
References KIGIT::BranchNameError(), IsHeadUnborn(), and m_repo.
Referenced by BOOST_AUTO_TEST_CASE(), and moveToNewBranch().
| bool KIGIT_COMMON::StashApply | ( | size_t | aIndex | ) |
Definition at line 1469 of file kicad_git_common.cpp.
References GetGitBackend(), m_repo, and GIT_BACKEND::StashApply().
Referenced by BOOST_AUTO_TEST_CASE(), and PANEL_GIT_STASHES::restoreSelectedStash().
| bool KIGIT_COMMON::StashDrop | ( | size_t | aIndex | ) |
Definition at line 1481 of file kicad_git_common.cpp.
References GetGitBackend(), m_repo, and GIT_BACKEND::StashDrop().
Referenced by BOOST_AUTO_TEST_CASE(), and PANEL_GIT_STASHES::onStashDrop().
| bool KIGIT_COMMON::StashPop | ( | size_t | aIndex | ) |
Definition at line 1475 of file kicad_git_common.cpp.
References GetGitBackend(), m_repo, and GIT_BACKEND::StashPop().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_GIT_STASHES::restoreSelectedStash().
| 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 1463 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().
| 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 2070 of file kicad_git_common.cpp.
References KIGIT_COMMON::REMOTE_URL::connType, KIGIT_COMMON::REMOTE_URL::hostname, 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, updatePublicKeys(), KIGIT_COMMON::REMOTE_URL::url, and KIGIT_COMMON::REMOTE_URL::username.
Referenced by credentials_cb(), FollowRewrittenUrl(), LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::Push(), resolveMissingRemote(), SetRemote(), and UpdateCurrentBranchInfo().
|
inline |
Definition at line 377 of file kicad_git_common.h.
References m_testedTypes.
|
inline |
Definition at line 674 of file kicad_git_common.h.
References m_gitActionMutex.
Referenced by KIGIT::TryLockAction().
| 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 1967 of file kicad_git_common.cpp.
References m_gitActionMutex.
Referenced by resolveMissingRemote(), and KIGIT::WaitForActionLock().
|
private |
Definition at line 2517 of file kicad_git_common.cpp.
References m_credentialsMutex, and updateConnectionTypeUnlocked().
|
private |
Body of updateConnectionType, for callers that already hold m_credentialsMutex.
Definition at line 2524 of file kicad_git_common.cpp.
References KIGIT_COMMON::REMOTE_URL::connType, KIGIT_COMMON::REMOTE_URL::hostname, m_connType, m_hostname, m_password, m_port, m_remote, m_secretFetched, m_urlUsername, m_username, ParseRemoteURL(), KIGIT_COMMON::REMOTE_URL::password, KIGIT_COMMON::REMOTE_URL::port, KIGIT_COMMON::REMOTE_URL::url, and KIGIT_COMMON::REMOTE_URL::username.
Referenced by SetRemote(), and updateConnectionType().
| void KIGIT_COMMON::UpdateCurrentBranchInfo | ( | ) |
Definition at line 2044 of file kicad_git_common.cpp.
References GetRemotename(), m_repo, and SyncRemoteUrl().
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), PROJECT_TREE_PANE::onGitRemoteSettings(), and PANEL_GIT_REMOTES::runRemoteAction().
|
private |
Definition at line 2032 of file kicad_git_common.cpp.
References KIGIT::DefaultSSHKeyCandidates(), KIGIT::HomeDir(), m_credentialsMutex, m_discoveredKeys, m_hostname, m_publicKeysHost, and rebuildPublicKeysUnlocked().
Referenced by SyncRemoteUrl().
|
friend |
Definition at line 724 of file kicad_git_common.h.
References GIT_CLONE_HANDLER.
Referenced by GIT_CLONE_HANDLER.
|
friend |
Definition at line 723 of file kicad_git_common.h.
References GIT_PULL_HANDLER.
Referenced by GIT_PULL_HANDLER.
|
friend |
Definition at line 722 of file kicad_git_common.h.
References GIT_PUSH_HANDLER.
Referenced by GIT_PUSH_HANDLER.
|
friend |
Definition at line 725 of file kicad_git_common.h.
References compareRefs(), and LIBGIT_BACKEND.
Referenced by LIBGIT_BACKEND.
|
staticconstexpr |
Long enough for a status read to finish, short enough that a window does not look hung.
Definition at line 680 of file kicad_git_common.h.
Referenced by PROJECT_TREE_PANE::onGitInitializeProject(), resolveMissingRemote(), and KIGIT::WaitForActionLock().
|
staticprivate |
Definition at line 766 of file kicad_git_common.h.
Referenced by HandleSSHAgentAuthentication(), and HandleSSHKeyAuthentication().
|
private |
Definition at line 760 of file kicad_git_common.h.
Referenced by ActiveCancelToken(), and SetShuttingDown().
|
protected |
Definition at line 699 of file kicad_git_common.h.
Referenced by GetAttachError(), and SetAttachError().
|
protected |
Definition at line 700 of file kicad_git_common.h.
Referenced by GetAttachTrustCommand(), and SetAttachError().
|
protected |
Definition at line 702 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), GetConnType(), GetCredentialIdentity(), GetPassword(), KIGIT_COMMON(), KIGIT_COMMON(), SetConnType(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().
|
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 717 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), FollowRewrittenUrl(), GetConnType(), GetCredentialIdentity(), GetFirstOfferedSSHKey(), GetNextPublicKey(), GetPassword(), GetRemote(), GetSSHKey(), GetUsername(), ResetNextKey(), SetConnType(), SetPassword(), SetRemote(), SetSSHKey(), SetUsername(), SSHPortFor(), SyncRemoteUrl(), updateConnectionType(), and updatePublicKeys().
|
private |
Definition at line 750 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), rebuildPublicKeysUnlocked(), and updatePublicKeys().
|
protected |
Definition at line 712 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), LockAction(), TryLockAction(), and TryLockActionFor().
|
protected |
Definition at line 705 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), SSHPortFor(), SyncRemoteUrl(), updateConnectionTypeUnlocked(), and updatePublicKeys().
|
private |
Definition at line 754 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), GetNextPublicKey(), KIGIT_COMMON(), KIGIT_COMMON(), rebuildPublicKeysUnlocked(), and ResetNextKey().
|
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 759 of file kicad_git_common.h.
Referenced by ActiveCancelToken(), IsShuttingDown(), and SetShuttingDown().
|
protected |
Definition at line 708 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), FollowRewrittenUrl(), GetPassword(), KIGIT_COMMON(), SetPassword(), SetRemote(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().
|
protected |
Definition at line 706 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), SSHPortFor(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().
|
protected |
Definition at line 697 of file kicad_git_common.h.
Referenced by GetProjectDir(), KIGIT_COMMON(), and SetProjectDir().
|
protected |
Definition at line 698 of file kicad_git_common.h.
Referenced by GetProjectPrefix(), KIGIT_COMMON(), and KIGIT_COMMON().
|
private |
Definition at line 753 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), GetFirstOfferedSSHKey(), GetSSHKey(), KIGIT_COMMON(), rebuildPublicKeysUnlocked(), and SetSSHKey().
|
private |
Definition at line 751 of file kicad_git_common.h.
Referenced by GetFirstOfferedSSHKey(), GetNextPublicKey(), GetSSHKey(), KIGIT_COMMON(), and rebuildPublicKeysUnlocked().
|
private |
Definition at line 752 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), SyncRemoteUrl(), and updatePublicKeys().
|
protected |
Definition at line 719 of file kicad_git_common.h.
Referenced by AddRefreshListener(), NotifyRefreshListeners(), and RemoveRefreshListener().
|
protected |
Definition at line 703 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), GetCredentialIdentity(), GetPassword(), GetRemote(), KIGIT_COMMON(), SetRemote(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().
|
protected |
Definition at line 695 of file kicad_git_common.h.
Referenced by AbandonOperation(), AddRemote(), CheckoutTag(), compareRefs(), CreateBranch(), CreateMergedCommit(), CreateTag(), DeleteBranch(), DeleteTag(), DiscardChanges(), GetBranchDetail(), GetBranches(), GetCommitDetail(), GetCurrentBranchName(), GetDifferentFiles(), GetGitRootDirectory(), GetHeadCommitId(), GetLastCommitMessage(), GetLastFetchTime(), GetMergeConflicts(), GetProjectDir(), GetProjectDirs(), GetProjectPrefix(), GetRecentCommitMessages(), GetRecentCommits(), GetRemotename(), GetRemotes(), GetRepo(), GetStashDetail(), GetStashes(), GetTagDetail(), GetTags(), GetUnmergedCommitCount(), GetWorkingTreeLineStats(), HasLocalCommits(), HasPushAndPullRemote(), HasUncommittedTrackedChanges(), HasUpstreamCommits(), IsHeadDetached(), IsHeadUnborn(), IsOperationInProgress(), IsPathConflicted(), IsPathInHead(), IsPullRebaseConfigured(), KIGIT_COMMON(), KIGIT_COMMON(), OperationInProgress(), remoteNameWithoutUpstream(), RemoveRemote(), SetRemoteUrl(), SetRepo(), SetUserConfig(), StartUnbornBranch(), StashApply(), StashDrop(), StashPop(), StashSave(), and UpdateCurrentBranchInfo().
|
private |
Definition at line 755 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), FollowRewrittenUrl(), GetPassword(), KIGIT_COMMON(), KIGIT_COMMON(), SetPassword(), SetRemote(), SetUsername(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().
|
private |
Definition at line 761 of file kicad_git_common.h.
Referenced by IsShuttingDown(), and SetShuttingDown().
|
protected |
Definition at line 710 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), HandlePlaintextAuthentication(), HandleSSHAgentAuthentication(), HandleSSHKeyAuthentication(), KIGIT_COMMON(), KIGIT_COMMON(), and TestedTypes().
|
protected |
Definition at line 704 of file kicad_git_common.h.
Referenced by KIGIT_COMMON(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().
|
protected |
Definition at line 707 of file kicad_git_common.h.
Referenced by ApplyPromptedCredentials(), FollowRewrittenUrl(), GetCredentialIdentity(), GetPassword(), GetUsername(), KIGIT_COMMON(), SetUsername(), SyncRemoteUrl(), and updateConnectionTypeUnlocked().