Skip to content

Commit

Permalink
Add after_operation enum to AbstractGitCommandItem
Browse files Browse the repository at this point in the history
  • Loading branch information
soramimi committed Jun 30, 2024
1 parent 4770bde commit a1e4055
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/GitProcessThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ GitCommandItem_fetch::GitCommandItem_fetch(const QString &progress_message, bool
: AbstractGitCommandItem(progress_message)
, prune(prune)
{
after_operation = Reopen;
update_commit_log = true;
}

Expand Down
7 changes: 6 additions & 1 deletion src/GitProcessThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ class AbstractGitCommandItem {
PtyProcess *pty = nullptr;
QString progress_message;
bool update_commit_log = false;
bool reopen_repository = true;
enum AfterOperation {
None,
Fetch,
Reopen,
};
AfterOperation after_operation = Fetch;
AbstractGitCommandItem(QString const &progress_message)
: progress_message(progress_message)
{
Expand Down
14 changes: 11 additions & 3 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1816,10 +1816,18 @@ void MainWindow::onPtyFetchCompleted(ProcessStatus const &status, QVariant const
GitProcessRequest const &req = userdata.value<GitProcessRequest>();
Q_ASSERT(req.params);

if (req.params->reopen_repository) {
switch (req.params->after_operation) {
case AbstractGitCommandItem::Reopen:
internalOpenRepository(git(), false, false);
} else if (req.params->update_commit_log) {
openRepositoryMain(frame(), git(), false, false, false, true);
break;
case AbstractGitCommandItem::Fetch:
fetch(git(), false);
break;
default:
if (req.params->update_commit_log) {
openRepositoryMain(frame(), git(), false, false, false, true);
}
break;
}
}

Expand Down

0 comments on commit a1e4055

Please sign in to comment.