|
KiCad PCB EDA Suite
|
Classes | |
| struct | CHANGED_FILE |
| struct | GIT_IDENTITY |
| Repository values and whether Git can use them to record a commit. More... | |
| struct | HOST_KEY_FAILURE |
| A server key the connection refused, for the UI to offer to trust or to report. More... | |
| struct | MERGE_BLOBS |
| Decoded ancestor/ours/theirs blob contents for a 3-way merge driver. More... | |
| class | PROJECT_GIT_UTILS |
| Utility class with helper functions for project level git operations. More... | |
| struct | TEXT_DIFF_LINE |
Typedefs | |
| using | GitRepositoryPtr |
| A unique pointer for git_repository objects with automatic cleanup. | |
| using | GitReferencePtr |
| A unique pointer for git_reference objects with automatic cleanup. | |
| using | GitObjectPtr |
| A unique pointer for git_object objects with automatic cleanup. | |
| using | GitCommitPtr |
| A unique pointer for git_commit objects with automatic cleanup. | |
| using | GitTreePtr |
| A unique pointer for git_tree objects with automatic cleanup. | |
| using | GitIndexPtr |
| A unique pointer for git_index objects with automatic cleanup. | |
| using | GitRebasePtr |
| A unique pointer for git_rebase objects with automatic cleanup. | |
| using | GitRevWalkPtr |
| A unique pointer for git_revwalk objects with automatic cleanup. | |
| using | GitDiffPtr |
| A unique pointer for git_diff objects with automatic cleanup. | |
| using | GitPatchPtr |
| A unique pointer for git_patch objects with automatic cleanup. | |
| using | GitReferenceIteratorPtr |
| A unique pointer for git_reference_iterator objects with automatic cleanup. | |
| using | GitSignaturePtr |
| A unique pointer for git_signature objects with automatic cleanup. | |
| using | GitConfigPtr |
| A unique pointer for git_config objects with automatic cleanup. | |
| using | GitRemotePtr |
| A unique pointer for git_remote objects with automatic cleanup. | |
| using | GitAnnotatedCommitPtr |
| A unique pointer for git_annotated_commit objects with automatic cleanup. | |
| using | GitOidPtr |
| A unique pointer for git_oid objects with automatic cleanup. | |
| using | GitBufPtr |
| A unique pointer for git_buf objects with automatic cleanup. | |
| using | GitBlamePtr |
| A unique pointer for git_blame objects with automatic cleanup. | |
| using | GitBlobPtr |
| A unique pointer for git_blob objects with automatic cleanup. | |
| using | GitBranchIteratorPtr |
| A unique pointer for git_branch_iterator objects with automatic cleanup. | |
| using | GitConfigEntryPtr |
| A unique pointer for git_config_entry objects with automatic cleanup. | |
| using | GitConfigIteratorPtr |
| A unique pointer for git_config_iterator objects with automatic cleanup. | |
| using | GitCredentialPtr |
| A unique pointer for git_credential objects with automatic cleanup. | |
| using | GitOidArrayPtr |
| A unique pointer for git_oidarray objects with automatic cleanup. | |
| using | GitStrArrayPtr |
| A unique pointer for git_strarray objects with automatic cleanup. | |
| using | GitDescribeResultPtr |
| A unique pointer for git_describe_result objects with automatic cleanup. | |
| using | GitDiffStatsPtr |
| A unique pointer for git_diff_stats objects with automatic cleanup. | |
| using | GitFilterListPtr |
| A unique pointer for git_filter_list objects with automatic cleanup. | |
| using | GitIndexerPtr |
| A unique pointer for git_indexer objects with automatic cleanup. | |
| using | GitIndexIteratorPtr |
| A unique pointer for git_index_iterator objects with automatic cleanup. | |
| using | GitIndexConflictIteratorPtr |
| A unique pointer for git_index_conflict_iterator objects with automatic cleanup. | |
| using | GitTreeEntryPtr |
| A unique pointer for git_tree_entry objects with automatic cleanup. | |
| using | GitStatusListPtr |
| A unique pointer for git_status_list objects with automatic cleanup. | |
| using | MERGE_APPLY_FN |
| Signature for a KiCad merge-driver apply function. | |
Enumerations | |
| enum class | FILE_CHANGE_STATUS { UNCHANGED , ADDED , REMOVED , MODIFIED , RENAMED , COPIED , TYPECHANGE } |
| enum class | KNOWN_HOST_STATE { UNKNOWN , MATCH , MISMATCH , OTHER_KEY_TYPE , REVOKED } |
| How a server's host key stands against known_hosts. More... | |
| enum class | TEXT_DIFF_KIND { CONTEXT , ADDED , REMOVED } |
Functions | |
| bool | PromptForCredentials (wxWindow *aParent, KIGIT_COMMON *aCommon, PROJECT *aProject=nullptr, const wxString &aExplanation=wxEmptyString) |
| Ask the user for the credentials of the session's remote and apply them to the session. | |
| bool | PromptToTrustHost (wxWindow *aParent, const HOST_KEY_FAILURE &aFailure, bool aRetriedAfterTrust) |
| Ask whether to trust a server seen for the first time, and remember its key when the user agrees. | |
| void | ClearSyncWarnings (wxWindow *aWindow) |
| Clear the background fetch's warnings from the frame holding aWindow. | |
| void | ClearSyncWarnings (const KIGIT_COMMON *aCommon) |
| A transfer that reached the remote answers the background fetch's warnings, so they go from every frame open on the project whose session aCommon is. | |
| GIT_IDENTITY | ReadGitIdentity (KIGIT_COMMON &aCommon) |
| Read on a worker while holding the session's action lock. | |
| GitUserConfig | ResolveGitIdentity (const GIT_IDENTITY &aIdentity, const COMMON_SETTINGS::GIT &aPreferences, const wxString &aUserName) |
| Fill missing values from custom preferences, then use the OS user name if needed. | |
| bool | EditGitIdentity (wxWindow *aParent, EDA_BASE_FRAME *aFrame, const std::shared_ptr< KIGIT_COMMON > &aCommon, const GIT_IDENTITY &aIdentity) |
| Edit the repository's author and refresh Git views after saving. | |
| bool | EnsureGitIdentity (wxWindow *aParent, EDA_BASE_FRAME *aFrame, const std::shared_ptr< KIGIT_COMMON > &aCommon, const GIT_IDENTITY &aIdentity) |
| Open the same editor when the worker snapshot has no usable Git identity. | |
| void | CallOnUi (std::function< void()> aFn) |
| Run aFn on the UI thread. | |
| void | CallIfAlive (const std::weak_ptr< bool > &aWatch, std::function< void()> aFn) |
| As CallOnUi, for work that touches the window that started the transfer. | |
| bool | StartTransfer (const std::string &aLabel, std::function< void()> aWork) |
| Run aWork on a thread the orphan registry owns. | |
| void | ShowBusyMessage (wxWindow *aParent) |
| Show a busy message for a user action. UI thread only. | |
| std::unique_lock< std::mutex > | TryLockAction (KIGIT_COMMON &aCommon, wxWindow *aParent) |
| Try the action lock and show a busy message if it is unavailable. | |
| std::unique_lock< std::mutex > | WaitForActionLock (KIGIT_COMMON &aCommon, wxWindow *aParent) |
| TryLockAction that first waits a moment for a status read or fetch to let go. | |
| void | SortBranchesForDisplay (std::vector< KIGIT_BRANCH_INFO > &aBranches) |
| Put the current branch first, then local and remote branches with the newest tips first. | |
| wxString | RelativeDate (const wxDateTime &aWhen) |
| "just now", "3 hours ago", or the ISO date once it is more than a month old. | |
| wxString | RelativeDate (const wxDateTime &aWhen, const wxDateTime &aNow) |
| void | UnsplitKeepingSash (wxSplitterWindow *aSplitter, wxWindow *aPane, int &aSashPos) |
| Close a splitter's second pane, keeping the sash where the user left it for next time. | |
| void | MarkDestructive (wxButton *aButton) |
| Paint a button's text the diff's red, for one that throws something away. | |
| wxString | SelectedText (wxListCtrl *aList, int aColumn) |
| The text of the selected row in a report list, or empty when nothing is selected. | |
| bool | ValidateIdentity (const wxString &aName, const wxString &aEmail, wxString &aError) |
| Check a name and email for recording commits. False leaves the reason in aError. | |
| const char * | FileChangeStatusToString (FILE_CHANGE_STATUS aStatus) |
| std::vector< CHANGED_FILE > | CompareRefs (git_repository *aRepo, const wxString &aBaseRef, const wxString &aHeadRef) |
| Compare two git refs (branch / tag / commit OID) within a repository and return the per-file change list. | |
| bool | IsPrivateKeyEncrypted (const wxString &aKeyText) |
| Report whether an SSH private key is protected by a passphrase. | |
| git_tree * | ResolveRefToTree (git_repository *aRepo, const wxString &aRef) |
| Resolve a string ref (branch name, short OID, full OID, tag) to its tree. | |
| std::vector< wxString > | CompareBranchRefs (git_repository *aRepo) |
| Refs to offer when comparing branches, base first and head second. | |
| void | CollectDiffDeltas (git_diff *aDiff, const std::function< void(const git_diff_delta &)> &aCallback) |
Walk every delta in a computed diff, invoking aCallback once per delta. | |
| wxString | BranchNameError (const wxString &aName) |
| Empty when aName is a branch name git would accept, otherwise why it would not, in the words to show the user. | |
| wxString | DecodeRepoText (const char *aText) |
| Decode text that came out of a repository. | |
| wxString | BusyMessage () |
| What every caller says when it finds the session already busy. | |
| wxString | ComposeCommitMessage (const wxString &aSummary, const wxString &aDescription, const wxString &aSignOff) |
| Join a summary line, an optional description and an optional sign-off into one commit message. | |
| void | SplitCommitMessage (const wxString &aMessage, wxString &aSummary, wxString &aDescription) |
| Split a commit message into its first line and the description after the first blank line. | |
| APIEXPORT wxWindow *& | ActiveAdvancedGitWindow () |
| The advanced git window, or null when none is open. | |
| bool | RegisterMergeDriver (const char *aName, MERGE_APPLY_FN aApply) |
| Register a KiCad merge driver with libgit2. | |
| APIEXPORT KIGIT_FAILURE_REPORT | DescribeGitFailure (const KIGIT_ERROR_INFO &aError, const KIGIT_AUTH_ATTEMPT &aAuth, const KIGIT_FAILURE_CONTEXT &aContext) |
| Turn a failed transfer into a message the user can act on. | |
| APIEXPORT wxString | UnexplainedFailure (KIGIT_OPERATION aOperation, const wxString &aUrl) |
| The summary for an operation that failed without saying why, naming the server it was talking to. | |
| APIEXPORT bool | IsCredentialFailure (KIGIT_FAILURE aKind) |
| True for the failures another login, key or passphrase can fix, which the credential prompt answers. | |
| APIEXPORT wxString | DecodeServerText (const char *aData, size_t aLength) |
| Bytes a server sent, as UTF-8 or, when they are not valid UTF-8, one character for each byte. | |
| APIEXPORT wxString | StripEmbeddedUserinfo (const wxString &aText) |
| Remove the user and password from every URL quoted in a message, since the remote's can carry a password. | |
| APIEXPORT wxString | PrintableServerText (const wxString &aText) |
| Text a server sent, made safe to show: no terminal escapes, control or bidi characters, and no URL userinfo. | |
| APIEXPORT KIGIT_OWNERSHIP_REFUSAL | DescribeOwnershipRefusal (const wxString &aStartDir, const wxString &aGitDir) |
| The message for a repository git refuses to open because another user owns it. | |
| APIEXPORT std::array< uint8_t, 20 > | HmacSha1 (const std::string &aKey, const std::string &aData) |
| HMAC-SHA1 (RFC 2104), as OpenSSH hashes host names in known_hosts. | |
| APIEXPORT KNOWN_HOST_STATE | LookupKnownHost (const wxString &aKnownHostsText, const wxString &aHost, int aPort, const wxString &aKeyType, const std::string &aRawKey) |
| Classify a server's key against the text of a known_hosts file, as OpenSSH reads it. | |
| APIEXPORT wxString | FormatKnownHostsLine (const wxString &aHost, int aPort, const wxString &aKeyType, const wxString &aBase64Key) |
| The known_hosts line ssh would write for a key, without a line ending. | |
| APIEXPORT wxString | HostKeyType (const std::string &aRawKey) |
| The type a raw SSH key names for itself, such as ssh-ed25519. Empty when the key is malformed. | |
| APIEXPORT wxString | HostKeyFingerprint (const std::string &aRawKey) |
| SHA256 of a raw key in unpadded base64, as ssh shows it after "SHA256:". | |
| APIEXPORT wxString | KnownHostsPath () |
| The known_hosts file libgit2 checks host keys against. Empty when it has no home folder. | |
| APIEXPORT bool | MayOfferTrust (const HOST_KEY_FAILURE &aFailure, bool aRetriedAfterTrust) |
| Whether the user may be asked to trust a refused key. | |
| APIEXPORT wxString | HostKeyRefusalMessage (const HOST_KEY_FAILURE &aFailure) |
| Why a key the user may not trust was refused, and what to do next. | |
| APIEXPORT wxString | Libgit2LegacyHome (int aRevision) |
The home folder libgit2 1.5 reads .ssh/known_hosts under, which it has no option to report. | |
| APIEXPORT wxString | ReadKnownHosts () |
| The text of KnownHostsPath(). Empty when it is missing or cannot be read. | |
| APIEXPORT bool | AddKnownHost (const HOST_KEY_FAILURE &aKey) |
| Append the refused key to KnownHostsPath(), creating the file and its folder when missing. | |
| std::string | BlobToString (git_blob *aBlob) |
| Copy a libgit2 blob's raw bytes into a std::string. | |
| int | WriteToGitBuf (git_buf *aBuf, const std::string &aContent) |
Allocate a libgit2-owned buffer big enough for aContent and copy the bytes plus a trailing NUL. | |
| int | LoadMergeBlobs (const git_merge_driver_source *aSource, MERGE_BLOBS &aBlobs) |
Look up the ancestor/ours/theirs blobs of a merge-driver source and decode them into aBlobs. | |
| bool | TryTrivialMerge (const MERGE_BLOBS &aBlobs, git_buf *aResult, int *aRc) |
| Resolve the trivial 3-way cases (identical sides, or one side unchanged from the ancestor). | |
| template<typename DRIVER> | |
| int | ApplyMergeDriver (const git_merge_driver_source *aSrc, const char **aPathOut, unsigned int *aModeOut, git_buf *aMergedOut) |
Shared libgit2 merge-driver apply callback shim. | |
| APIEXPORT std::vector< wxString > | ParseSSHConfigIdentityFiles (const wxString &aConfigText, const wxString &aHost, const wxString &aHomeDir) |
The IdentityFile entries an ssh config gives aHost, in file order. | |
| APIEXPORT std::vector< wxString > | DefaultSSHKeyCandidates (const wxString &aHomeDir, const wxString &aHost) |
Private keys to offer aHost, best first. | |
| APIEXPORT bool | IsSameSSHKey (const wxString &aKey, const wxString &aOther) |
| Whether two key paths name the same file. | |
| APIEXPORT wxString | HomeDir () |
| The user's home folder, where ssh looks for its config and default keys. | |
| APIEXPORT bool | IsOfferableSSHKey (const wxString &aKey) |
Whether aKey can be offered to a server. | |
| static wxString | canonicalDir (const wxString &aPath) |
| static bool | pathIsUnder (const wxString &aAbsPath, const wxString &aProjectPath) |
| static std::optional< wxString > | prefixUnder (const wxString &aWorkDir, const wxString &aProjectPath) |
| std::vector< wxString > | SplitTextLines (const std::string &aContent) |
| Tolerates CRLF endings and content that is not valid UTF-8. | |
| bool | TextLooksBinary (const std::string &aContent) |
| std::vector< TEXT_DIFF_LINE > | BuildTextDiff (const std::vector< wxString > &aOld, const std::vector< wxString > &aNew) |
| Every line of both sides appears once. There are no hunks and nothing is elided. | |
Variables | |
| constexpr const wxChar * | SYNC_WARNING_SOURCE = wxS( "git" ) |
| The status bar source under which background fetch failures are listed. | |
| constexpr size_t | MAX_SERVER_TEXT = 4096 |
| The longest server text a failure keeps. A refusal's explanation comes last, after any transfer progress. | |
A unique pointer for git_annotated_commit objects with automatic cleanup.
Definition at line 136 of file kicad_git_memory.h.
| using KIGIT::GitBlamePtr |
A unique pointer for git_blame objects with automatic cleanup.
Definition at line 160 of file kicad_git_memory.h.
| using KIGIT::GitBlobPtr |
A unique pointer for git_blob objects with automatic cleanup.
Definition at line 168 of file kicad_git_memory.h.
A unique pointer for git_branch_iterator objects with automatic cleanup.
Definition at line 176 of file kicad_git_memory.h.
| using KIGIT::GitBufPtr |
A unique pointer for git_buf objects with automatic cleanup.
Definition at line 152 of file kicad_git_memory.h.
| using KIGIT::GitCommitPtr |
A unique pointer for git_commit objects with automatic cleanup.
Definition at line 48 of file kicad_git_memory.h.
| using KIGIT::GitConfigEntryPtr |
A unique pointer for git_config_entry objects with automatic cleanup.
Definition at line 184 of file kicad_git_memory.h.
A unique pointer for git_config_iterator objects with automatic cleanup.
Definition at line 192 of file kicad_git_memory.h.
| using KIGIT::GitConfigPtr |
A unique pointer for git_config objects with automatic cleanup.
Definition at line 120 of file kicad_git_memory.h.
| using KIGIT::GitCredentialPtr |
A unique pointer for git_credential objects with automatic cleanup.
Definition at line 200 of file kicad_git_memory.h.
A unique pointer for git_describe_result objects with automatic cleanup.
Definition at line 224 of file kicad_git_memory.h.
| using KIGIT::GitDiffPtr |
A unique pointer for git_diff objects with automatic cleanup.
Definition at line 88 of file kicad_git_memory.h.
| using KIGIT::GitDiffStatsPtr |
A unique pointer for git_diff_stats objects with automatic cleanup.
Definition at line 232 of file kicad_git_memory.h.
| using KIGIT::GitFilterListPtr |
A unique pointer for git_filter_list objects with automatic cleanup.
Definition at line 240 of file kicad_git_memory.h.
A unique pointer for git_index_conflict_iterator objects with automatic cleanup.
Definition at line 264 of file kicad_git_memory.h.
| using KIGIT::GitIndexerPtr |
A unique pointer for git_indexer objects with automatic cleanup.
Definition at line 248 of file kicad_git_memory.h.
A unique pointer for git_index_iterator objects with automatic cleanup.
Definition at line 256 of file kicad_git_memory.h.
| using KIGIT::GitIndexPtr |
A unique pointer for git_index objects with automatic cleanup.
Definition at line 64 of file kicad_git_memory.h.
| using KIGIT::GitObjectPtr |
A unique pointer for git_object objects with automatic cleanup.
Definition at line 41 of file kicad_git_memory.h.
| using KIGIT::GitOidArrayPtr |
A unique pointer for git_oidarray objects with automatic cleanup.
Definition at line 208 of file kicad_git_memory.h.
| using KIGIT::GitOidPtr |
A unique pointer for git_oid objects with automatic cleanup.
Definition at line 144 of file kicad_git_memory.h.
| using KIGIT::GitPatchPtr |
A unique pointer for git_patch objects with automatic cleanup.
Definition at line 96 of file kicad_git_memory.h.
| using KIGIT::GitRebasePtr |
A unique pointer for git_rebase objects with automatic cleanup.
Definition at line 72 of file kicad_git_memory.h.
A unique pointer for git_reference_iterator objects with automatic cleanup.
Definition at line 104 of file kicad_git_memory.h.
| using KIGIT::GitReferencePtr |
A unique pointer for git_reference objects with automatic cleanup.
Definition at line 33 of file kicad_git_memory.h.
| using KIGIT::GitRemotePtr |
A unique pointer for git_remote objects with automatic cleanup.
Definition at line 128 of file kicad_git_memory.h.
| using KIGIT::GitRepositoryPtr |
A unique pointer for git_repository objects with automatic cleanup.
Definition at line 25 of file kicad_git_memory.h.
| using KIGIT::GitRevWalkPtr |
A unique pointer for git_revwalk objects with automatic cleanup.
Definition at line 80 of file kicad_git_memory.h.
| using KIGIT::GitSignaturePtr |
A unique pointer for git_signature objects with automatic cleanup.
Definition at line 112 of file kicad_git_memory.h.
| using KIGIT::GitStatusListPtr |
A unique pointer for git_status_list objects with automatic cleanup.
Definition at line 280 of file kicad_git_memory.h.
| using KIGIT::GitStrArrayPtr |
A unique pointer for git_strarray objects with automatic cleanup.
Definition at line 216 of file kicad_git_memory.h.
| using KIGIT::GitTreeEntryPtr |
A unique pointer for git_tree_entry objects with automatic cleanup.
Definition at line 272 of file kicad_git_memory.h.
| using KIGIT::GitTreePtr |
A unique pointer for git_tree objects with automatic cleanup.
Definition at line 56 of file kicad_git_memory.h.
| using KIGIT::MERGE_APPLY_FN |
Signature for a KiCad merge-driver apply function.
Mirrors the libgit2 merge driver apply callback, but with simpler args because we only need the source + a target buffer.
src - libgit2 merge driver source (ancestor/ours/theirs blobs) path_out - destination for the resulting path mode_out - destination for the resulting file mode merged_out - destination buffer for the merged blob
Returns 0 on success, GIT_EMERGECONFLICT (-13) on unresolved conflicts, or any other negative git error code on failure. uint32_t for mode_out per libgit2; included via <cstdint> by callers.
Definition at line 47 of file kigit_driver_registry.h.
|
strong |
| Enumerator | |
|---|---|
| UNCHANGED | |
| ADDED | |
| REMOVED | |
| MODIFIED | |
| RENAMED | |
| COPIED | |
| TYPECHANGE | |
Definition at line 37 of file git_compare_handler.h.
|
strong |
How a server's host key stands against known_hosts.
| Enumerator | |
|---|---|
| UNKNOWN | No entry names the host with a key of this type. |
| MATCH | An entry names the host with this key. |
| MISMATCH | Entries name the host with another key of this type, and none with this one. |
| OTHER_KEY_TYPE | Entries name the host only with keys of other types. |
| REVOKED | A @revoked entry carries this key. |
Definition at line 35 of file kigit_known_hosts.h.
|
strong |
| Enumerator | |
|---|---|
| CONTEXT | |
| ADDED | |
| REMOVED | |
Definition at line 36 of file text_diff.h.
| wxWindow *& KIGIT::ActiveAdvancedGitWindow | ( | ) |
The advanced git window, or null when none is open.
Kept here because libcommon is linked into the project manager and into each editor separately, so a static there would give every one of them a window of its own.
Definition at line 51 of file kicad_git_common.cpp.
Referenced by activeDialog(), and setActiveDialog().
| bool KIGIT::AddKnownHost | ( | const HOST_KEY_FAILURE & | aKey | ) |
Append the refused key to KnownHostsPath(), creating the file and its folder when missing.
Existing entries are never rewritten. Returns false when the line could not be written.
Definition at line 413 of file kigit_known_hosts.cpp.
References FormatKnownHostsLine(), KIGIT::HOST_KEY_FAILURE::host, KIGIT::HOST_KEY_FAILURE::keyType, KnownHostsPath(), path, KIGIT::HOST_KEY_FAILURE::port, and KIGIT::HOST_KEY_FAILURE::rawKey.
Referenced by PromptToTrustHost().
| int KIGIT::ApplyMergeDriver | ( | const git_merge_driver_source * | aSrc, |
| const char ** | aPathOut, | ||
| unsigned int * | aModeOut, | ||
| git_buf * | aMergedOut ) |
Shared libgit2 merge-driver apply callback shim.
Constructs DRIVER over the source, runs its Merge(), and on success or conflict copies ours' path and mode to the outputs. DRIVER must expose a (git_merge_driver_source*, git_buf*) constructor and an int Merge() method.
Definition at line 88 of file kigit_merge_blob_utils.h.
Referenced by KIGIT_PCB_MERGE::Apply(), and KIGIT_TRIVIAL_MERGE_BASE< DERIVED >::Apply().
| KICOMMON_API std::string KIGIT::BlobToString | ( | git_blob * | aBlob | ) |
Copy a libgit2 blob's raw bytes into a std::string.
Returns an empty string if the blob is null.
Definition at line 36 of file kigit_merge_blob_utils.cpp.
Referenced by LoadMergeBlobs().
| APIEXPORT wxString KIGIT::BranchNameError | ( | const wxString & | aName | ) |
Empty when aName is a branch name git would accept, otherwise why it would not, in the words to show the user.
Definition at line 3083 of file kicad_git_common.cpp.
References _.
Referenced by BOOST_AUTO_TEST_CASE(), KIGIT::PROJECT_GIT_UTILS::CreateBranch(), KIGIT_COMMON::CreateBranch(), GIT_COMMIT_PANE::doCommit(), PANEL_GIT_BRANCHES::onNewBranch(), KIGIT_COMMON::StartUnbornBranch(), and PROJECT_TREE_PANE::switchGitBranch().
| KICOMMON_API std::vector< TEXT_DIFF_LINE > KIGIT::BuildTextDiff | ( | const std::vector< wxString > & | aOld, |
| const std::vector< wxString > & | aNew ) |
Every line of both sides appears once. There are no hunks and nothing is elided.
Definition at line 77 of file text_diff.cpp.
References ADDED, CONTEXT, REMOVED, and result.
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(), and GIT_FILE_DIFF_AREA::ShowFile().
| APIEXPORT wxString KIGIT::BusyMessage | ( | ) |
What every caller says when it finds the session already busy.
One wording, so the same condition does not reach the user in three different sentences.
Definition at line 3125 of file kicad_git_common.cpp.
References _.
Referenced by LIBGIT_BACKEND::PerformFetch(), LIBGIT_BACKEND::PerformPull(), and ShowBusyMessage().
| void KIGIT::CallIfAlive | ( | const std::weak_ptr< bool > & | aWatch, |
| std::function< void()> | aFn ) |
As CallOnUi, for work that touches the window that started the transfer.
aWatch is locked on the UI thread, so a window that has gone is never touched.
Definition at line 41 of file git_transfer.cpp.
References CallOnUi().
Referenced by KIGIT_STATUS_REPORTER::updateUI().
| void KIGIT::CallOnUi | ( | std::function< void()> | aFn | ) |
Run aFn on the UI thread.
For a transfer that outlives the window that started it. The work is queued on the application rather than on that window, because the window may be part way through its own destructor, and queueing onto a handler being destroyed is a race.
Definition at line 32 of file git_transfer.cpp.
Referenced by CallIfAlive(), KIGIT_TRANSFER::Start(), GIT_ADVANCED_DIALOG::startFetch(), PANEL_GIT_BRANCHES::startForcePush(), GIT_COMMIT_PANE::startPull(), and GIT_COMMIT_PANE::startPush().
|
static |
Definition at line 129 of file project_git_utils.cpp.
Referenced by KIGIT::PROJECT_GIT_UTILS::ComputeSymlinkPreservingWorkDir(), KIGIT::PROJECT_GIT_UTILS::IsWithinProjectPath(), and KIGIT::PROJECT_GIT_UTILS::ProjectPrefix().
| void KIGIT::ClearSyncWarnings | ( | const KIGIT_COMMON * | aCommon | ) |
A transfer that reached the remote answers the background fetch's warnings, so they go from every frame open on the project whose session aCommon is.
Definition at line 209 of file git_credentials_prompt.cpp.
References ClearSyncWarnings(), PROJECT::GetGitCommon(), KIWAY_HOLDER::HasKiway(), and KIWAY_HOLDER::Prj().
| void KIGIT::ClearSyncWarnings | ( | wxWindow * | aWindow | ) |
Clear the background fetch's warnings from the frame holding aWindow.
Definition at line 194 of file git_credentials_prompt.cpp.
References SYNC_WARNING_SOURCE.
Referenced by ClearSyncWarnings(), PROJECT_TREE_PANE::EmptyTreePrj(), PROJECT_TREE_PANE::onGitInitializeProject(), GIT_COMMIT_PANE::onPullDone(), GIT_COMMIT_PANE::onPushDone(), PROJECT_TREE_PANE::reportGitSyncResult(), and PROJECT_TREE_PANE::syncGitListener().
| APIEXPORT void KIGIT::CollectDiffDeltas | ( | git_diff * | aDiff, |
| const std::function< void(const git_diff_delta &)> & | aCallback ) |
Walk every delta in a computed diff, invoking aCallback once per delta.
Centralizes the git_diff_num_deltas / git_diff_get_delta loop. Null deltas are skipped. A null diff is a no-op.
The callback is a std::function rather than a header-inline template because this helper lives behind the APIEXPORT/libkicommon ABI boundary; a template would have to re-expose the git2 loop in the header to every caller.
Definition at line 3063 of file kicad_git_common.cpp.
References delta.
Referenced by LIBGIT_BACKEND::AbandonOperation(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CompareRefs(), KIGIT_COMMON::GetDifferentFiles(), and KIGIT_COMMON::GetStashDetail().
| APIEXPORT std::vector< wxString > KIGIT::CompareBranchRefs | ( | git_repository * | aRepo | ) |
Refs to offer when comparing branches, base first and head second.
Only refs that resolve are listed. The base is main or master when it is not the current branch, else the current branch's upstream. The head is the current branch, or HEAD when detached.
The caller must hold the git action lock.
Definition at line 3001 of file kicad_git_common.cpp.
References git_repository, main(), and ResolveRefToTree().
Referenced by KICAD_MANAGER_FRAME::OnCompareProjectBranches().
| KICOMMON_API std::vector< CHANGED_FILE > KIGIT::CompareRefs | ( | git_repository * | aRepo, |
| const wxString & | aBaseRef, | ||
| const wxString & | aHeadRef ) |
Compare two git refs (branch / tag / commit OID) within a repository and return the per-file change list.
Used by the git PR-review dialog (Phase 10) to populate the "changed files" list a user clicks through to open the file-compare dialog.
aRepo must not be null. Returns an empty vector on error and logs via wxLogTrace( traceGit ).
Definition at line 76 of file git_compare_handler.cpp.
References CollectDiffDeltas(), KIGIT_COMMON::GetLastGitError(), git_repository, KIGIT::CHANGED_FILE::oldPath, KIGIT::CHANGED_FILE::path, ResolveRefToTree(), result, KIGIT::CHANGED_FILE::status, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), MaterializeCommitFile(), DIALOG_GIT_MR_REVIEW::populateFileList(), and ShowGitCommitDiff().
| APIEXPORT wxString KIGIT::ComposeCommitMessage | ( | const wxString & | aSummary, |
| const wxString & | aDescription, | ||
| const wxString & | aSignOff ) |
Join a summary line, an optional description and an optional sign-off into one commit message.
aSignOff is the "Name <email>" to put after "Signed-off-by:", or empty for none. A message that already ends with that sign-off does not get it twice.
Definition at line 3131 of file kicad_git_common.cpp.
References message.
Referenced by GIT_COMMIT_PANE::BeginAmend(), BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::finishCommit(), and GIT_COMMIT_PANE::GetCommitMessage().
| APIEXPORT wxString KIGIT::DecodeRepoText | ( | const char * | aText | ) |
Decode text that came out of a repository.
Git stores it as bytes with no encoding, so a repository written on Windows can carry ISO 8859-1, which FromUTF8 alone would blank.
Definition at line 3111 of file kicad_git_common.cpp.
References decoded().
Referenced by KIGIT_COMMON::GetBranchDetail(), KIGIT_COMMON::GetBranches(), KIGIT_COMMON::GetCommitDetail(), KIGIT_COMMON::GetLastCommitMessage(), KIGIT_COMMON::GetRecentCommitMessages(), KIGIT_COMMON::GetRecentCommits(), KIGIT_COMMON::GetStashDetail(), KIGIT_COMMON::GetTagDetail(), and KIGIT_COMMON::GetTags().
| wxString KIGIT::DecodeServerText | ( | const char * | aData, |
| size_t | aLength ) |
Bytes a server sent, as UTF-8 or, when they are not valid UTF-8, one character for each byte.
Definition at line 451 of file kigit_failure.cpp.
References text.
Referenced by push_update_reference_cb(), KIGIT_REPO_MIXIN::ReceiveSideband(), and KIGIT_REPO_MIXIN::ReportTransferFailure().
| std::vector< wxString > KIGIT::DefaultSSHKeyCandidates | ( | const wxString & | aHomeDir, |
| const wxString & | aHost ) |
Private keys to offer aHost, best first.
The ssh config's IdentityFile entries for the host come first, then id_ed25519, id_ecdsa, id_rsa and id_dsa from aHomeDir/.ssh. Only keys whose private and public files both exist are listed. An empty aHomeDir gives no keys.
Definition at line 198 of file kigit_ssh_keys.cpp.
References candidates(), config, decoded(), IsOfferableSSHKey(), name, ParseSSHConfigIdentityFiles(), path, and text.
Referenced by DIALOG_GIT_REPOSITORY::setDefaultSSHKey(), and KIGIT_COMMON::updatePublicKeys().
| KIGIT_FAILURE_REPORT KIGIT::DescribeGitFailure | ( | const KIGIT_ERROR_INFO & | aError, |
| const KIGIT_AUTH_ATTEMPT & | aAuth, | ||
| const KIGIT_FAILURE_CONTEXT & | aContext ) |
Turn a failed transfer into a message the user can act on.
The libgit2 code decides first, then its error class, then what the credential callback offered, and last the resolver and connection texts libgit2 and libssh2 write themselves. Those are never translated. Text a server sends is shown to the user but never decides the kind, so only its codes are relied on.
Definition at line 424 of file kigit_failure.cpp.
References classifyGitFailure(), KIGIT_FAILURE_REPORT::details, KIGIT_FAILURE_REPORT::kind, and KIGIT_FAILURE_REPORT::summary.
Referenced by DIALOG_GIT_REPOSITORY::OnTestClick(), KIGIT_REPO_MIXIN::ReportTransferFailure(), and LIBGIT_BACKEND::SetupRemote().
| KIGIT_OWNERSHIP_REFUSAL KIGIT::DescribeOwnershipRefusal | ( | const wxString & | aStartDir, |
| const wxString & | aGitDir ) |
The message for a repository git refuses to open because another user owns it.
git checks the working folder, so that is the one named: the nearest folder at or above aStartDir that holds a .git file or folder, spelled as libgit2 resolves it. A bare repository has none and keeps aGitDir, the git directory discovery found.
Definition at line 584 of file kigit_failure.cpp.
References _, config, GIT_BUF_INIT, isRootedLikeLibgit2(), path, quoteForShell(), and resolveLikeLibgit2().
Referenced by LIBGIT_BACKEND::GetRepositoryForFile().
| bool KIGIT::EditGitIdentity | ( | wxWindow * | aParent, |
| EDA_BASE_FRAME * | aFrame, | ||
| const std::shared_ptr< KIGIT_COMMON > & | aCommon, | ||
| const GIT_IDENTITY & | aIdentity ) |
Edit the repository's author and refresh Git views after saving.
UI thread only. Refuse to save if the frame changes project while the dialog is open.
Definition at line 274 of file git_credentials_prompt.cpp.
References _, config, DisplayErrorMessage(), DIALOG_GIT_IDENTITY::GetAuthorName(), DIALOG_GIT_IDENTITY::GetEmail(), Pgm(), ResolveGitIdentity(), DIALOG_SHIM::ShowModal(), and WaitForActionLock().
Referenced by EnsureGitIdentity(), PANEL_GIT_REPOSITORY::onEditAuthor(), and GIT_COMMIT_PANE::setAuthor().
| bool KIGIT::EnsureGitIdentity | ( | wxWindow * | aParent, |
| EDA_BASE_FRAME * | aFrame, | ||
| const std::shared_ptr< KIGIT_COMMON > & | aCommon, | ||
| const GIT_IDENTITY & | aIdentity ) |
Open the same editor when the worker snapshot has no usable Git identity.
Definition at line 322 of file git_credentials_prompt.cpp.
References KIGIT::GIT_IDENTITY::configured, and EditGitIdentity().
Referenced by GIT_COMMIT_PANE::finishCommit(), GIT_COMMIT_PANE::finishPullConflictPreparation(), KICAD_MANAGER_CONTROL::NewFromRepository(), PANEL_GIT_STASHES::onStashSave(), PANEL_GIT_HISTORY::restoreVersion(), and GIT_COMMIT_PANE::submitPull().
| KICOMMON_API const char * KIGIT::FileChangeStatusToString | ( | FILE_CHANGE_STATUS | aStatus | ) |
Definition at line 38 of file git_compare_handler.cpp.
References ADDED, COPIED, MODIFIED, REMOVED, RENAMED, TYPECHANGE, and UNCHANGED.
Referenced by DIALOG_GIT_MR_REVIEW::populateFileList().
| wxString KIGIT::FormatKnownHostsLine | ( | const wxString & | aHost, |
| int | aPort, | ||
| const wxString & | aKeyType, | ||
| const wxString & | aBase64Key ) |
The known_hosts line ssh would write for a key, without a line ending.
Definition at line 324 of file kigit_known_hosts.cpp.
Referenced by AddKnownHost().
| std::array< uint8_t, 20 > KIGIT::HmacSha1 | ( | const std::string & | aKey, |
| const std::string & | aData ) |
HMAC-SHA1 (RFC 2104), as OpenSSH hashes host names in known_hosts.
Definition at line 227 of file kigit_known_hosts.cpp.
| wxString KIGIT::HomeDir | ( | ) |
The user's home folder, where ssh looks for its config and default keys.
Empty when unknown. Safe to call from any thread.
Definition at line 268 of file kigit_ssh_keys.cpp.
Referenced by DIALOG_GIT_REPOSITORY::setDefaultSSHKey(), and KIGIT_COMMON::updatePublicKeys().
| wxString KIGIT::HostKeyFingerprint | ( | const std::string & | aRawKey | ) |
SHA256 of a raw key in unpadded base64, as ssh shows it after "SHA256:".
Definition at line 349 of file kigit_known_hosts.cpp.
Referenced by certificate_check_cb().
| wxString KIGIT::HostKeyRefusalMessage | ( | const HOST_KEY_FAILURE & | aFailure | ) |
Why a key the user may not trust was refused, and what to do next.
Definition at line 455 of file kigit_known_hosts.cpp.
References _, KIGIT::HOST_KEY_FAILURE::host, MISMATCH, KIGIT::HOST_KEY_FAILURE::port, REVOKED, and KIGIT::HOST_KEY_FAILURE::state.
Referenced by PromptToTrustHost().
| wxString KIGIT::HostKeyType | ( | const std::string & | aRawKey | ) |
The type a raw SSH key names for itself, such as ssh-ed25519. Empty when the key is malformed.
Definition at line 331 of file kigit_known_hosts.cpp.
Referenced by certificate_check_cb().
| bool KIGIT::IsCredentialFailure | ( | KIGIT_FAILURE | aKind | ) |
True for the failures another login, key or passphrase can fix, which the credential prompt answers.
Definition at line 444 of file kigit_failure.cpp.
References AUTH_HTTPS_REJECTED, AUTH_NO_SSH_KEY, AUTH_SSH_KEY_REJECTED, and KEY_LOAD_FAILED.
Referenced by KIGIT_REPO_MIXIN::ReportTransferFailure().
| bool KIGIT::IsOfferableSSHKey | ( | const wxString & | aKey | ) |
Whether aKey can be offered to a server.
libgit2 opens both files only once the connection is under way, and a missing one ends the attempt instead of trying the next key.
Definition at line 292 of file kigit_ssh_keys.cpp.
Referenced by DefaultSSHKeyCandidates(), KIGIT_COMMON::GetFirstOfferedSSHKey(), KIGIT_COMMON::GetNextPublicKey(), initialSSHKey(), and KIGIT_COMMON::rebuildPublicKeysUnlocked().
| APIEXPORT bool KIGIT::IsPrivateKeyEncrypted | ( | const wxString & | aKeyText | ) |
Report whether an SSH private key is protected by a passphrase.
aKeyText is the whole contents of the private key file. Anything not recognised as a private key is reported as unencrypted.
Definition at line 2916 of file kicad_git_common.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and DIALOG_GIT_REPOSITORY::OnFileUpdated().
| bool KIGIT::IsSameSSHKey | ( | const wxString & | aKey, |
| const wxString & | aOther ) |
Whether two key paths name the same file.
Separators are normalised, and case is ignored where the file system ignores it.
Definition at line 257 of file kigit_ssh_keys.cpp.
Referenced by KIGIT_COMMON::rebuildPublicKeysUnlocked().
| wxString KIGIT::KnownHostsPath | ( | ) |
The known_hosts file libgit2 checks host keys against. Empty when it has no home folder.
Definition at line 360 of file kigit_known_hosts.cpp.
References GIT_BUF_INIT, Libgit2LegacyHome(), and path.
Referenced by AddKnownHost(), PromptToTrustHost(), and ReadKnownHosts().
| wxString KIGIT::Libgit2LegacyHome | ( | int | aRevision | ) |
The home folder libgit2 1.5 reads .ssh/known_hosts under, which it has no option to report.
1.5.1 reads HOME at each connection and 1.5.2 takes the folder 1.6 would. 1.5.0 reads no trust store, so KiCad keeps its own where 1.5.2 would look.
| aRevision | The patch level of the libgit2 1.5 in use. |
Definition at line 483 of file kigit_known_hosts.cpp.
Referenced by KnownHostsPath().
| KICOMMON_API int KIGIT::LoadMergeBlobs | ( | const git_merge_driver_source * | aSource, |
| MERGE_BLOBS & | aBlobs ) |
Look up the ancestor/ours/theirs blobs of a merge-driver source and decode them into aBlobs.
The blobs are freed before returning (only the strings are kept), so callers need no cleanup.
Returns 0 on success, GIT_PASSTHROUGH when ours/theirs are missing, or GIT_ENOTFOUND when a blob lookup fails.
Definition at line 62 of file kigit_merge_blob_utils.cpp.
References KIGIT::MERGE_BLOBS::ancestor, BlobToString(), git_repository, KIGIT::MERGE_BLOBS::ours, and KIGIT::MERGE_BLOBS::theirs.
Referenced by KIGIT_PCB_MERGE::Merge(), and KIGIT_TRIVIAL_MERGE_BASE< DERIVED >::Merge().
| KIGIT::KNOWN_HOST_STATE KIGIT::LookupKnownHost | ( | const wxString & | aKnownHostsText, |
| const wxString & | aHost, | ||
| int | aPort, | ||
| const wxString & | aKeyType, | ||
| const std::string & | aRawKey ) |
Classify a server's key against the text of a known_hosts file, as OpenSSH reads it.
Entries name the host as [host]:port, or as host on port 22, either plainly, with *, ? and ! patterns, or hashed. A @revoked host entry applies on every port, because libssh2 also accepts a plain host entry for every port. @cert-authority entries are ignored.
| aKeyType | The key's type as known_hosts names it. |
| aRawKey | The key as the server sent it. |
Definition at line 256 of file kigit_known_hosts.cpp.
References MATCH, MISMATCH, OTHER_KEY_TYPE, REVOKED, and UNKNOWN.
Referenced by certificate_check_cb().
| void KIGIT::MarkDestructive | ( | wxButton * | aButton | ) |
Paint a button's text the diff's red, for one that throws something away.
Definition at line 134 of file git_ui_utils.cpp.
References KICAD_DIFF::DIFF_COLOR_THEME::ForText(), KIPLATFORM::UI::IsDarkTheme(), KICAD_DIFF::DIFF_COLOR_THEME::removed, and KIGFX::COLOR4D::ToColour().
Referenced by PANEL_GIT_BRANCHES::PANEL_GIT_BRANCHES(), PANEL_GIT_REMOTES::PANEL_GIT_REMOTES(), PANEL_GIT_STASHES::PANEL_GIT_STASHES(), and PANEL_GIT_TAGS::PANEL_GIT_TAGS().
| bool KIGIT::MayOfferTrust | ( | const HOST_KEY_FAILURE & | aFailure, |
| bool | aRetriedAfterTrust ) |
Whether the user may be asked to trust a refused key.
A changed or revoked key never may, and an operation already retried after a trust reports a second refusal instead of asking again.
Definition at line 446 of file kigit_known_hosts.cpp.
References OTHER_KEY_TYPE, KIGIT::HOST_KEY_FAILURE::state, and UNKNOWN.
Referenced by PromptToTrustHost().
| std::vector< wxString > KIGIT::ParseSSHConfigIdentityFiles | ( | const wxString & | aConfigText, |
| const wxString & | aHost, | ||
| const wxString & | aHomeDir ) |
The IdentityFile entries an ssh config gives aHost, in file order.
Host patterns match aHost case-sensitively, as typed in the remote address, without resolving HostName. Match blocks are skipped. A leading ~ and every d expand to aHomeDir; a value holding any other % token is returned unexpanded.
Definition at line 156 of file kigit_ssh_keys.cpp.
Referenced by DefaultSSHKeyCandidates().
|
static |
Definition at line 216 of file project_git_utils.cpp.
Referenced by KIGIT::PROJECT_GIT_UTILS::IsWithinProjectPath().
|
static |
Definition at line 251 of file project_git_utils.cpp.
Referenced by KIGIT::PROJECT_GIT_UTILS::ProjectPrefix().
| wxString KIGIT::PrintableServerText | ( | const wxString & | aText | ) |
Text a server sent, made safe to show: no terminal escapes, control or bidi characters, and no URL userinfo.
Line breaks are kept.
Definition at line 497 of file kigit_failure.cpp.
References StripEmbeddedUserinfo(), and text.
Referenced by push_update_reference_cb(), KIGIT_REPO_MIXIN::ReceiveSideband(), KIGIT_REPO_MIXIN::ReportTransferFailure(), and KIGIT_REPO_MIXIN::SetPushRefusal().
| bool KIGIT::PromptForCredentials | ( | wxWindow * | aParent, |
| KIGIT_COMMON * | aCommon, | ||
| PROJECT * | aProject = nullptr, | ||
| const wxString & | aExplanation = wxEmptyString ) |
Ask the user for the credentials of the session's remote and apply them to the session.
Optionally stores them in the OS keychain. Clears the auth-failure state so the caller can retry the operation.
| aParent | Parent window for the dialog. |
| aCommon | Session to update with the entered credentials. |
| aProject | When given, the corrected username and key are also written to the project's stored settings, so a later repository attach does not revert them. |
| aExplanation | Why the last attempt failed, shown above the fields. Nothing is shown when empty. |
Definition at line 81 of file git_credentials_prompt.cpp.
References _, KIGIT_COMMON::ApplyPromptedCredentials(), KIGIT_COMMON::CREDENTIAL_IDENTITY::connType, KIGIT_COMMON::PROMPTED_CREDENTIALS::connType, DisplayInfoMessage(), DIALOG_GIT_CREDENTIALS::GetConnType(), KIGIT_COMMON::GetCredentialIdentity(), PROJECT::GetLocalSettings(), DIALOG_GIT_CREDENTIALS::GetPassword(), DIALOG_GIT_CREDENTIALS::GetSSHKey(), DIALOG_GIT_CREDENTIALS::GetUsername(), KIGIT_COMMON::GIT_CONN_LOCAL, KIGIT_COMMON::GIT_CONN_SSH, initialSSHKey(), PROJECT_LOCAL_SETTINGS::m_GitRepoType, PROJECT_LOCAL_SETTINGS::m_GitRepoUsername, PROJECT_LOCAL_SETTINGS::m_GitSSHKey, KIGIT_COMMON::ParseRemoteURL(), KIGIT_COMMON::PROMPTED_CREDENTIALS::password, KIGIT_COMMON::CREDENTIAL_IDENTITY::remote, resolveMissingRemote(), DIALOG_GIT_CREDENTIALS::SaveCredentials(), DIALOG_SHIM::ShowModal(), KIGIT_COMMON::PROMPTED_CREDENTIALS::sshKey, KIPLATFORM::SECRETS::StoreSecret(), traceGit, KIGIT_COMMON::CREDENTIAL_IDENTITY::username, KIGIT_COMMON::PROMPTED_CREDENTIALS::username, and KIGIT_COMMON::REMOTE_URL::username.
Referenced by GIT_COMMIT_PANE::onPullDone(), GIT_COMMIT_PANE::onPushDone(), and promptForGitCredentials().
| bool KIGIT::PromptToTrustHost | ( | wxWindow * | aParent, |
| const HOST_KEY_FAILURE & | aFailure, | ||
| bool | aRetriedAfterTrust ) |
Ask whether to trust a server seen for the first time, and remember its key when the user agrees.
A changed or revoked key is refused with an explanation and no way to accept it.
| aRetriedAfterTrust | The operation already ran again after a trust, so it is refused instead. |
Definition at line 146 of file git_credentials_prompt.cpp.
References _, AddKnownHost(), DisplayErrorMessage(), KIGIT::HOST_KEY_FAILURE::fingerprint, KIGIT::HOST_KEY_FAILURE::host, HostKeyRefusalMessage(), KICAD_MESSAGE_DIALOG, KnownHostsPath(), MayOfferTrust(), OTHER_KEY_TYPE, KIGIT::HOST_KEY_FAILURE::port, and KIGIT::HOST_KEY_FAILURE::state.
Referenced by KICAD_MANAGER_CONTROL::NewFromRepository(), PROJECT_TREE_PANE::onGitInitializeProject(), GIT_COMMIT_PANE::onPullDone(), GIT_COMMIT_PANE::onPushDone(), and DIALOG_GIT_REPOSITORY::OnTestClick().
| KIGIT::GIT_IDENTITY KIGIT::ReadGitIdentity | ( | KIGIT_COMMON & | aCommon | ) |
Read on a worker while holding the session's action lock.
Definition at line 222 of file git_credentials_prompt.cpp.
References GitUserConfig::authorEmail, GitUserConfig::authorName, KIGIT::GIT_IDENTITY::config, KIGIT::GIT_IDENTITY::configured, GIT_BACKEND::GetConfigString(), GetGitBackend(), KIGIT_COMMON::GetRepo(), GitUserConfig::hasEmail, and GitUserConfig::hasName.
Referenced by BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::doCommit(), KICAD_MANAGER_CONTROL::NewFromRepository(), PANEL_GIT_REPOSITORY::onEditAuthor(), PANEL_GIT_HISTORY::onRestoreVersion(), PANEL_GIT_STASHES::onStashSave(), GIT_COMMIT_PANE::resolvePullConflicts(), GIT_COMMIT_PANE::setAuthor(), and GIT_COMMIT_PANE::submitPull().
| wxString KIGIT::ReadKnownHosts | ( | ) |
The text of KnownHostsPath(). Empty when it is missing or cannot be read.
Definition at line 390 of file kigit_known_hosts.cpp.
References decoded(), KnownHostsPath(), path, and text.
Referenced by certificate_check_cb().
| KICOMMON_API bool KIGIT::RegisterMergeDriver | ( | const char * | aName, |
| MERGE_APPLY_FN | aApply ) |
Register a KiCad merge driver with libgit2.
The driver name must match the merge=<name> attribute set in .gitattributes (e.g. "kicad-pcb", "kicad-sch", "kicad-sym", "kicad-fp-lib").
Idempotent: calling twice with the same name is a no-op. Thread-safety: libgit2's git_merge_driver_register is NOT thread-safe; this function holds an internal mutex around the call, but callers should still ensure it runs once at process init, before any thread fan-out (libgit2 may not tolerate concurrent registration even with our local mutex if its global driver table is read by a parallel merge).
Returns true on success.
Definition at line 80 of file kigit_driver_registry.cpp.
References KIGIT_COMMON::GetLastGitError(), name, and traceGit.
Referenced by PCB::IFACE::OnKifaceStart(), and SCH::IFACE::OnKifaceStart().
| wxString KIGIT::RelativeDate | ( | const wxDateTime & | aWhen | ) |
"just now", "3 hours ago", or the ISO date once it is more than a month old.
Definition at line 93 of file git_ui_utils.cpp.
References RelativeDate().
Referenced by PANEL_GIT_HISTORY::appendHistoryRows(), PANEL_GIT_BRANCHES::fillBranchDetail(), PANEL_GIT_HISTORY::fillCommitDetail(), PANEL_GIT_REMOTES::fillRemoteDetail(), PANEL_GIT_STASHES::fillStashDetail(), PANEL_GIT_TAGS::fillTagDetail(), and RelativeDate().
| wxString KIGIT::RelativeDate | ( | const wxDateTime & | aWhen, |
| const wxDateTime & | aNow ) |
Definition at line 99 of file git_ui_utils.cpp.
References _.
| GitUserConfig KIGIT::ResolveGitIdentity | ( | const GIT_IDENTITY & | aIdentity, |
| const COMMON_SETTINGS::GIT & | aPreferences, | ||
| const wxString & | aUserName ) |
Fill missing values from custom preferences, then use the OS user name if needed.
Definition at line 240 of file git_credentials_prompt.cpp.
References COMMON_SETTINGS::GIT::authorEmail, COMMON_SETTINGS::GIT::authorName, config, KIGIT::GIT_IDENTITY::config, and COMMON_SETTINGS::GIT::useDefaultAuthor.
Referenced by BOOST_AUTO_TEST_CASE(), and EditGitIdentity().
| APIEXPORT git_tree * KIGIT::ResolveRefToTree | ( | git_repository * | aRepo, |
| const wxString & | aRef ) |
Resolve a string ref (branch name, short OID, full OID, tag) to its tree.
Runs git_revparse_single followed by git_object_peel( GIT_OBJECT_TREE ), so a commit, tag or tree ref all resolve to the underlying tree. Returns nullptr on error and logs via wxLogTrace( traceGit ).
The caller owns the returned tree and must free it with git_tree_free (wrap in KIGIT::GitTreePtr for RAII). The return type is a raw pointer rather than GitTreePtr because the lambda-deleter closure type backing GitTreePtr is distinct per translation unit, so it cannot cross the kicommon ABI boundary.
Definition at line 2972 of file kicad_git_common.cpp.
References KIGIT_COMMON::GetLastGitError(), git_repository, and traceGit.
Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), CompareBranchRefs(), CompareRefs(), DIALOG_GIT_MR_REVIEW::populateFileList(), KIGIT::PROJECT_GIT_UTILS::WriteBlobToFile(), and KIGIT::PROJECT_GIT_UTILS::WriteTreeToDir().
| wxString KIGIT::SelectedText | ( | wxListCtrl * | aList, |
| int | aColumn ) |
The text of the selected row in a report list, or empty when nothing is selected.
Definition at line 189 of file git_ui_utils.cpp.
Referenced by PANEL_GIT_TAGS::onCheckoutTag(), PANEL_GIT_BRANCHES::onDeleteBranch(), PANEL_GIT_TAGS::onDeleteTag(), PANEL_GIT_REMOTES::onEditRemote(), PANEL_GIT_BRANCHES::onNewBranch(), and PANEL_GIT_REMOTES::onRemoveRemote().
| void KIGIT::ShowBusyMessage | ( | wxWindow * | aParent | ) |
Show a busy message for a user action. UI thread only.
Definition at line 38 of file git_ui_utils.cpp.
References BusyMessage(), and DisplayInfoMessage().
Referenced by GIT_COMMIT_PANE::doCommit(), GIT_ADVANCED_DIALOG::onFetch(), PANEL_GIT_BRANCHES::onForcePush(), GIT_COMMIT_PANE::onPushDone(), GIT_COMMIT_PANE::runActionQuery(), GIT_COMMIT_PANE::transferCanStart(), TryLockAction(), and WaitForActionLock().
| void KIGIT::SortBranchesForDisplay | ( | std::vector< KIGIT_BRANCH_INFO > & | aBranches | ) |
Put the current branch first, then local and remote branches with the newest tips first.
Use the name to break ties. Callers can choose a different order.
Definition at line 71 of file git_ui_utils.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), GIT_ADVANCED_DIALOG::populateTopBar(), GIT_COMMIT_PANE::RefreshFileList(), and PROJECT_TREE_PANE::showContextMenu().
| APIEXPORT void KIGIT::SplitCommitMessage | ( | const wxString & | aMessage, |
| wxString & | aSummary, | ||
| wxString & | aDescription ) |
Split a commit message into its first line and the description after the first blank line.
Definition at line 3164 of file kicad_git_common.cpp.
References message.
Referenced by GIT_COMMIT_PANE::BeginAmend(), BOOST_AUTO_TEST_CASE(), GIT_COMMIT_PANE::onRecentMessage(), and GIT_COMMIT_PANE::SetCommitMessage().
| KICOMMON_API std::vector< wxString > KIGIT::SplitTextLines | ( | const std::string & | aContent | ) |
Tolerates CRLF endings and content that is not valid UTF-8.
Definition at line 28 of file text_diff.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and GIT_FILE_DIFF_AREA::ShowFile().
| bool KIGIT::StartTransfer | ( | const std::string & | aLabel, |
| std::function< void()> | aWork ) |
Run aWork on a thread the orphan registry owns.
The registry joins with a bounded timeout at shutdown and detaches whatever has not finished, so a window closing mid transfer never waits for the socket. False when no thread could be started, which only happens once shutdown has begun.
Definition at line 52 of file git_transfer.cpp.
References GetGitBackend(), GIT_BACKEND::OrphanRegistry(), and KIGIT_ORPHAN_REGISTRY::Register().
Referenced by KIGIT_TRANSFER::Start().
| wxString KIGIT::StripEmbeddedUserinfo | ( | const wxString & | aText | ) |
Remove the user and password from every URL quoted in a message, since the remote's can carry a password.
Definition at line 463 of file kigit_failure.cpp.
References result.
Referenced by KIGIT_ERRORS::AddError(), credentials_cb(), DIALOG_GIT_CREDENTIALS::DIALOG_GIT_CREDENTIALS(), KIGIT_COMMON::GetLastGitError(), KIGIT_COMMON::GetRemotes(), and PrintableServerText().
| KICOMMON_API bool KIGIT::TextLooksBinary | ( | const std::string & | aContent | ) |
Definition at line 68 of file text_diff.cpp.
Referenced by BOOST_AUTO_TEST_CASE(), and GIT_FILE_DIFF_AREA::ShowFile().
|
nodiscard |
Try the action lock and show a busy message if it is unavailable.
UI thread only. Check owns_lock() before using the repository.
Definition at line 44 of file git_ui_utils.cpp.
References ShowBusyMessage(), and KIGIT_COMMON::TryLockAction().
Referenced by GIT_COMMIT_PANE::confirmDiscardFile(), GIT_COMMIT_PANE::finishAbandonOperation(), GIT_COMMIT_PANE::finishCommit(), PROJECT_TREE_PANE::onGitRemoteSettings(), DIALOG_GIT_MR_REVIEW::openFileDiff(), DIALOG_GIT_MR_REVIEW::populateFileList(), PANEL_GIT_HISTORY::restoreVersion(), and SwitchProjectToBranch().
| KICOMMON_API bool KIGIT::TryTrivialMerge | ( | const MERGE_BLOBS & | aBlobs, |
| git_buf * | aResult, | ||
| int * | aRc ) |
Resolve the trivial 3-way cases (identical sides, or one side unchanged from the ancestor).
On a trivial hit the resolved content is written to aResult, aRc is set to the WriteToGitBuf return code, and true is returned. Returns false when a real merge is required.
Definition at line 99 of file kigit_merge_blob_utils.cpp.
References KIGIT::MERGE_BLOBS::ancestor, KIGIT::MERGE_BLOBS::ours, KIGIT::MERGE_BLOBS::theirs, and WriteToGitBuf().
Referenced by KIGIT_TRIVIAL_MERGE_BASE< DERIVED >::Merge().
| wxString KIGIT::UnexplainedFailure | ( | KIGIT_OPERATION | aOperation, |
| const wxString & | aUrl ) |
The summary for an operation that failed without saying why, naming the server it was talking to.
Definition at line 435 of file kigit_failure.cpp.
References KIGIT_FAILURE_CONTEXT::operation, OTHER, and KIGIT_FAILURE_CONTEXT::url.
Referenced by GIT_COMMIT_PANE::onPullDone(), and GIT_COMMIT_PANE::onPushDone().
| void KIGIT::UnsplitKeepingSash | ( | wxSplitterWindow * | aSplitter, |
| wxWindow * | aPane, | ||
| int & | aSashPos ) |
Close a splitter's second pane, keeping the sash where the user left it for next time.
Definition at line 122 of file git_ui_utils.cpp.
Referenced by PANEL_GIT_HISTORY::clearCommitDetail(), PANEL_GIT_BRANCHES::hideBranchDetail(), PANEL_GIT_HISTORY::hideFileDiff(), PANEL_GIT_REMOTES::hideRemoteDetail(), PANEL_GIT_STASHES::hideStashDetail(), PANEL_GIT_TAGS::hideTagDetail(), and GIT_ADVANCED_DIALOG::hideWorkingDiff().
| bool KIGIT::ValidateIdentity | ( | const wxString & | aName, |
| const wxString & | aEmail, | ||
| wxString & | aError ) |
Check a name and email for recording commits. False leaves the reason in aError.
Definition at line 169 of file git_ui_utils.cpp.
References _, looksLikeAnEmailAddress(), and name.
Referenced by BOOST_AUTO_TEST_CASE(), and DIALOG_GIT_IDENTITY::TransferDataFromWindow().
|
nodiscard |
TryLockAction that first waits a moment for a status read or fetch to let go.
For applying what the user has already typed, which the busy message would throw away.
Definition at line 55 of file git_ui_utils.cpp.
References KIGIT_COMMON::ACTION_LOCK_WAIT, ShowBusyMessage(), and KIGIT_COMMON::TryLockActionFor().
Referenced by EditGitIdentity(), PROJECT_TREE_PANE::onGitRemoteSettings(), and PROJECT_TREE_PANE::switchGitBranch().
| KICOMMON_API int KIGIT::WriteToGitBuf | ( | git_buf * | aBuf, |
| const std::string & | aContent ) |
Allocate a libgit2-owned buffer big enough for aContent and copy the bytes plus a trailing NUL.
Uses git_buf_grow so libgit2 disposes the buffer correctly via git_buf_dispose.
Returns 0 on success, -1 on allocation failure.
Definition at line 47 of file kigit_merge_blob_utils.cpp.
Referenced by KIGIT_PCB_MERGE::Merge(), KIGIT_TRIVIAL_MERGE_BASE< DERIVED >::Merge(), and TryTrivialMerge().
|
constexpr |
The longest server text a failure keeps. A refusal's explanation comes last, after any transfer progress.
Definition at line 130 of file kigit_failure.h.
Referenced by KIGIT_REPO_MIXIN::addServerLine(), KIGIT_REPO_MIXIN::ReceiveSideband(), and KIGIT_REPO_MIXIN::SetPushRefusal().
|
inlineconstexpr |
The status bar source under which background fetch failures are listed.
Definition at line 63 of file git_credentials_prompt.h.
Referenced by ClearSyncWarnings(), and PROJECT_TREE_PANE::reportGitSyncResult().