Allow git init to succeed without remote
This commit is contained in:
@@ -85,6 +85,15 @@ public:
|
||||
|
||||
void SetEncrypted( bool aEncrypted = true );
|
||||
|
||||
void SetSkipButtonLabel( const wxString& aLabel )
|
||||
{
|
||||
if( m_sdbSizerCancel )
|
||||
{
|
||||
m_sdbSizerCancel->SetLabel( aLabel );
|
||||
m_sdbSizerCancel->Layout();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||
void OnLocationExit( wxFocusEvent& event ) override;
|
||||
|
||||
@@ -76,6 +76,10 @@ InitResult GIT_INIT_HANDLER::InitializeRepository( const wxString& aPath )
|
||||
|
||||
bool GIT_INIT_HANDLER::SetupRemote( const RemoteConfig& aConfig )
|
||||
{
|
||||
// This is an optional step
|
||||
if( aConfig.url.IsEmpty() )
|
||||
return true;
|
||||
|
||||
git_repository* repo = GetRepo();
|
||||
|
||||
if( !repo )
|
||||
|
||||
@@ -1663,21 +1663,15 @@ void PROJECT_TREE_PANE::onGitInitializeProject( wxCommandEvent& aEvent )
|
||||
}
|
||||
|
||||
GIT_INIT_HANDLER initHandler( m_TreeProject->GitCommon() );
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( this );
|
||||
|
||||
if( initHandler.IsRepository( dir ) )
|
||||
{
|
||||
wxWindow* topLevelParent = wxGetTopLevelParent( this );
|
||||
DisplayInfoMessage( topLevelParent,
|
||||
_( "The selected directory is already a Git project." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
DIALOG_GIT_REPOSITORY dlg( wxGetTopLevelParent( this ), nullptr );
|
||||
dlg.SetTitle( _( "Set default remote" ) );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
InitResult result = initHandler.InitializeRepository( dir );
|
||||
if( result != InitResult::Success )
|
||||
{
|
||||
@@ -1688,6 +1682,13 @@ void PROJECT_TREE_PANE::onGitInitializeProject( wxCommandEvent& aEvent )
|
||||
|
||||
m_gitLastError = GIT_ERROR_NONE;
|
||||
|
||||
DIALOG_GIT_REPOSITORY dlg( topLevelParent, initHandler.GetRepo() );
|
||||
dlg.SetTitle( _( "Set default remote" ) );
|
||||
dlg.SetSkipButtonLabel( _( "Skip" ) );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
// Set up the remote
|
||||
RemoteConfig remoteConfig;
|
||||
remoteConfig.url = dlg.GetRepoURL();
|
||||
|
||||
Reference in New Issue
Block a user