mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-18 19:39:17 +00:00
Git: handle new-but-already-staged files
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19893
This commit is contained in:
parent
172b77039f
commit
f59c5a9a26
@ -99,18 +99,27 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo,
|
||||
m_listCtrl->SetItem( i, 1, _( "New" ) );
|
||||
m_listCtrl->SetItemImage(
|
||||
i, static_cast<int>( KIGIT_COMMON::GIT_STATUS::GIT_STATUS_ADDED ) );
|
||||
|
||||
if( status & ( GIT_STATUS_INDEX_NEW ) )
|
||||
m_listCtrl->CheckItem( i, true );
|
||||
}
|
||||
else if( status & ( GIT_STATUS_INDEX_MODIFIED | GIT_STATUS_WT_MODIFIED ) )
|
||||
{
|
||||
m_listCtrl->SetItem( i, 1, _( "Modified" ) );
|
||||
m_listCtrl->SetItemImage(
|
||||
i, static_cast<int>( KIGIT_COMMON::GIT_STATUS::GIT_STATUS_MODIFIED ) );
|
||||
|
||||
if( status & ( GIT_STATUS_INDEX_MODIFIED ) )
|
||||
m_listCtrl->CheckItem( i, true );
|
||||
}
|
||||
else if( status & ( GIT_STATUS_INDEX_DELETED | GIT_STATUS_WT_DELETED ) )
|
||||
{
|
||||
m_listCtrl->SetItem( i, 1, _( "Deleted" ) );
|
||||
m_listCtrl->SetItemImage(
|
||||
i, static_cast<int>( KIGIT_COMMON::GIT_STATUS::GIT_STATUS_DELETED ) );
|
||||
|
||||
if( status & ( GIT_STATUS_INDEX_DELETED ) )
|
||||
m_listCtrl->CheckItem( i, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,4 +229,4 @@ std::vector<wxString> DIALOG_GIT_COMMIT::GetSelectedFiles() const
|
||||
}
|
||||
|
||||
return selectedFiles;
|
||||
}
|
||||
}
|
||||
|
@ -2208,10 +2208,28 @@ void PROJECT_TREE_PANE::onGitCommit( wxCommandEvent& aEvent )
|
||||
continue;
|
||||
}
|
||||
|
||||
wxFileName fn( entry->index_to_workdir->old_file.path );
|
||||
fn.MakeAbsolute( git_repository_workdir( repo ) );
|
||||
wxFileName fn;
|
||||
wxString filePath;
|
||||
|
||||
wxString filePath( entry->index_to_workdir->old_file.path, wxConvUTF8 );
|
||||
// TODO: we are kind of erasing the difference between workdir and index here,
|
||||
// because the Commit dialog doesn't show that difference.
|
||||
// Entry may only have a head_to_index if it was previously staged
|
||||
if( entry->index_to_workdir )
|
||||
{
|
||||
fn.Assign( entry->index_to_workdir->old_file.path );
|
||||
fn.MakeAbsolute( git_repository_workdir( repo ) );
|
||||
filePath = wxString( entry->index_to_workdir->old_file.path, wxConvUTF8 );
|
||||
}
|
||||
else if( entry->head_to_index )
|
||||
{
|
||||
fn.Assign( entry->head_to_index->old_file.path );
|
||||
fn.MakeAbsolute( git_repository_workdir( repo ) );
|
||||
filePath = wxString( entry->head_to_index->old_file.path, wxConvUTF8 );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxCHECK2_MSG( false, continue, "File status with neither git_status_entry set!" );
|
||||
}
|
||||
|
||||
if( aEvent.GetId() == ID_GIT_COMMIT_PROJECT )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user