27#include <wx/weakref.h>
60 DisplayInfoMessage( aParent,
_(
"The credentials could not be saved to the system keychain, so they "
61 "are kept for this session only." ) );
92 git_signature* signature =
nullptr;
93 identity.
configured = git_signature_default( &signature, aCommon.
GetRepo() ) == GIT_OK;
100 const wxString& aUserName )
106 if(
config.authorName.IsEmpty() )
109 if(
config.authorEmail.IsEmpty() )
113 if(
config.authorName.IsEmpty() )
114 config.authorName = aUserName;
123bool identitySessionCurrent(
EDA_BASE_FRAME* aFrame,
const std::shared_ptr<KIGIT_COMMON>& aCommon )
125 return aFrame && !aFrame->IsBeingDeleted() && aCommon && !aCommon->IsShuttingDown() && aCommon->GetRepo()
136 if( !identitySessionCurrent( aFrame, aCommon ) )
139 wxWeakRef<EDA_BASE_FRAME> frame( aFrame );
140 wxWeakRef<wxWindow> parent( aParent );
153 if( !parent || parent->IsBeingDeleted() || !identitySessionCurrent( frame.get(), aCommon ) )
161 if( !lock.owns_lock() )
164 if( !identitySessionCurrent( frame.get(), aCommon ) )
167 saved = aCommon->SetUserConfig(
config.authorName,
config.authorEmail );
176 aCommon->NotifyRefreshListeners();
184 if( !identitySessionCurrent( aFrame, aCommon ) )
KIGIT_COMMON::GIT_CONN_TYPE GetConnType() const
wxString GetPassword() const
wxString GetUsername() const
wxString GetSSHKey() const
bool SaveCredentials() const
Ask for the name and email to record commits with.
wxString GetEmail() const
The base frame for deriving all KiCad main window classes.
virtual bool GetConfigString(GIT_CONFIG_HANDLER *aHandler, const wxString &aKey, wxString &aValue)=0
The project's git session.
GIT_CONN_TYPE GetConnType() const
wxString GetRemote() const
wxString GetSSHKey() const
The key this session prefers, which is the one the project was set up with.
void SetSSHKey(const wxString &aSSHKey)
void SetUsername(const wxString &aUsername)
git_repository * GetRepo() const
wxString GetUsername() const
std::atomic< unsigned > & TestedTypes()
void SetPassword(const wxString &aPassword)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual COMMON_SETTINGS * GetCommonSettings() const
bool m_GitIntegrationDisabled
If true, KiCad will not use Git integration for this project even if a .git directory exists.
wxString m_GitRepoUsername
Container for project specific data.
virtual std::shared_ptr< KIGIT_COMMON > GetGitCommon() const
This project's Git session, created empty on first use.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
Base window classes and related definitions.
GIT_BACKEND * GetGitBackend()
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.
GIT_IDENTITY ReadGitIdentity(KIGIT_COMMON &aCommon)
Read on a worker while holding the session's action lock.
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.
bool PromptForCredentials(wxWindow *aParent, KIGIT_COMMON *aCommon, PROJECT *aProject=nullptr)
Ask the user for the credentials of the session's remote and apply them to the session.
std::unique_lock< std::mutex > TryLockAction(KIGIT_COMMON &aCommon, wxWindow *aParent)
Try the action lock and show a busy message if it is unavailable.
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.
std::unique_ptr< git_signature, decltype([](git_signature *aSignature) { git_signature_free(aSignature); })> GitSignaturePtr
A unique pointer for git_signature objects with automatic cleanup.
PGM_BASE & Pgm()
The global program "get" accessor.
Repository values and whether Git can use them to record a commit.