mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 17:17:42 +00:00
HackStudio: Fix GitWidget issues with switching between projects
GitWidget no longer crashes upon trying to create a repository for a new project, and it correctly updates after opening a different project. A new method, change_repo, has been added to make this work, which changes m_repo_root and resets most of the widget's state in order to make this work.
This commit is contained in:
parent
d9c295de46
commit
d454c63bde
3 changed files with 13 additions and 0 deletions
|
@ -164,4 +164,12 @@ void GitWidget::show_diff(const LexicalPath& file_path)
|
||||||
VERIFY(original_content.has_value() && diff.has_value());
|
VERIFY(original_content.has_value() && diff.has_value());
|
||||||
m_view_diff_callback(original_content.value(), diff.value());
|
m_view_diff_callback(original_content.value(), diff.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GitWidget::change_repo(LexicalPath const& repo_root)
|
||||||
|
{
|
||||||
|
m_repo_root = repo_root;
|
||||||
|
m_git_repo = nullptr;
|
||||||
|
m_unstaged_files->set_model(nullptr);
|
||||||
|
m_staged_files->set_model(nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ public:
|
||||||
void refresh();
|
void refresh();
|
||||||
void set_view_diff_callback(ViewDiffCallback callback);
|
void set_view_diff_callback(ViewDiffCallback callback);
|
||||||
bool initialized() const { return !m_git_repo.is_null(); };
|
bool initialized() const { return !m_git_repo.is_null(); };
|
||||||
|
void change_repo(LexicalPath const& repo_root);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit GitWidget(const LexicalPath& repo_root);
|
explicit GitWidget(const LexicalPath& repo_root);
|
||||||
|
|
|
@ -202,6 +202,10 @@ void HackStudioWidget::open_project(const String& root_path)
|
||||||
m_project_tree_view->set_model(m_project->model());
|
m_project_tree_view->set_model(m_project->model());
|
||||||
m_project_tree_view->update();
|
m_project_tree_view->update();
|
||||||
}
|
}
|
||||||
|
if (m_git_widget) {
|
||||||
|
m_git_widget->change_repo(LexicalPath(root_path));
|
||||||
|
m_git_widget->refresh();
|
||||||
|
}
|
||||||
if (Debugger::is_initialized()) {
|
if (Debugger::is_initialized()) {
|
||||||
auto& debugger = Debugger::the();
|
auto& debugger = Debugger::the();
|
||||||
debugger.reset_breakpoints();
|
debugger.reset_breakpoints();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue