Git: do not try to get branch info if there isn't a repo

This commit is contained in:
Jon Evans 2025-02-08 16:34:08 -05:00
parent 04387dd42f
commit df70ce72b4

View File

@ -639,10 +639,14 @@ void PROJECT_TREE_PANE::ReCreateTreePrj()
if( ADVANCED_CFG::GetCfg().m_EnableGit )
{
m_TreeProject->SetGitRepo( get_git_repository_for_file( fn.GetPath().c_str() ) );
if( m_TreeProject->GetGitRepo() )
{
m_TreeProject->GitCommon()->SetUsername( Prj().GetLocalSettings().m_GitRepoUsername );
m_TreeProject->GitCommon()->SetSSHKey( Prj().GetLocalSettings().m_GitSSHKey );
m_TreeProject->GitCommon()->UpdateCurrentBranchInfo();
}
}
// We may have opened a legacy project, in which case GetProjectFileName will return the
// name of the migrated (new format) file, which may not have been saved to disk yet.