[VCS] IJPL-73963 Abort/continue rebase notification should disappear when rebase is finished

Merge-request: IJ-MR-177822
Merged-by: Radu Nedelcu [External] <radu.nedelcu.external@jetbrains.com>

GitOrigin-RevId: 7b191f0e753e059bd14052396e10f8d269c00730
This commit is contained in:
Radu Nedelcu
2025-10-09 10:23:30 +00:00
committed by intellij-monorepo-bot
parent c93901260e
commit bece9f25d5
3 changed files with 52 additions and 5 deletions
@@ -14,6 +14,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManagerEx;
import com.intellij.vcs.log.Hash;
import git4idea.DialogManager;
import git4idea.GitActivity;
import git4idea.GitNotificationIdsHolder;
import git4idea.GitUtil;
import git4idea.commands.Git;
import git4idea.commands.GitCommandResult;
@@ -155,7 +156,7 @@ class GitAbortRebaseProcess {
private void doAbort(final boolean rollback) {
boolean[] success = new boolean[1];
myNotifier.hideAllNotificationsById(REBASE_STOPPED_ON_EDITING);
new GitFreezingProcess(myProject, GitBundle.message("activity.name.rebase"), () -> {
String activityName = GitBundle.message("activity.name.abort.command", GitBundle.message("abort.operation.rebase.name"));
try (AccessToken ignore = DvcsUtil.workingTreeChangeStarted(myProject, activityName, GitActivity.Abort)) {
@@ -246,6 +246,7 @@ public class GitRebaseProcess {
return new GitRebaseStatus(GitRebaseStatus.Type.SUSPENDED);
}
LOG.debug("Successfully rebased " + repoName);
hideStoppedForEditingMessage();
return new GitSuccessfulRebase();
}
else if (rebaseDetector.isDirtyTree() && customMode == null && !retryWhenDirty) {
@@ -439,7 +440,11 @@ public class GitRebaseProcess {
.setDisplayId(GitNotificationIdsHolder.REBASE_STOPPED_ON_EDITING)
.addAction(CONTINUE_ACTION)
.addAction(ABORT_ACTION);
myNotifier.notify(notification);
myNotifier.showNotificationAndHideExisting(notification);
}
private void hideStoppedForEditingMessage() {
myNotifier.hideAllNotificationsById(GitNotificationIdsHolder.REBASE_STOPPED_ON_EDITING);
}
private void showRebaseContinueHasUnstagedChangesError(@NotNull GitRepository repository,
@@ -592,7 +592,7 @@ class GitSingleRepoRebaseTest : GitRebaseBaseTest() {
assertSuccessfulRebaseNotification("Rebased feature on master")
}
fun `test interactive rebase stopped for editing`() {
fun `test interactive rebase stopped for editing with continue`() {
build {
master {
0()
@@ -617,16 +617,57 @@ class GitSingleRepoRebaseTest : GitRebaseBaseTest() {
rebaseInteractively()
assertSuccessfulNotification("Rebase stopped for editing", "")
val successfulNotification = vcsNotifier.lastNotification
assertEquals("The repository must be in the 'SUSPENDED' state", repo, repositoryManager.ongoingRebaseSpec!!.ongoingRebase)
GitRebaseUtils.continueRebase(project)
assertSuccessfulRebaseNotification("Rebased feature on master")
// IJPL-73963
assertTrue(successfulNotification.isExpired)
repo.`assert feature rebased on master`()
assertNoRebaseInProgress(repo)
}
// IDEA-140568
fun `test interactive rebase stopped for editing with abort`() {
build {
master {
0()
1()
}
feature(1) {
2()
3()
}
}
git.setInteractiveRebaseEditor(TestGitImpl.InteractiveRebaseEditor({
it.lines().mapIndexed { i, s ->
if (i != 0) s
else s.replace("pick", "edit")
}.joinToString(LineSeparator.getSystemLineSeparator().separatorString)
}, null))
refresh()
updateChangeListManager()
rebaseInteractively()
assertSuccessfulNotification("Rebase stopped for editing", "")
val successfulNotification = vcsNotifier.lastNotification
assertEquals("The repository must be in the 'SUSPENDED' state", repo, repositoryManager.ongoingRebaseSpec!!.ongoingRebase)
dialogManager.onMessage { Messages.YES }
GitRebaseUtils.abort(project, EmptyProgressIndicator())
assertSuccessfulNotification("Abort rebase succeeded")
// IJPL-73963
assertTrue(successfulNotification.isExpired)
assertNoRebaseInProgress(repo)
}
// IDEA-140568
fun `test git help comments are ignored when parsing interactive rebase`() {
makeCommit("initial.txt")
repo.update()