Skip to content

fix: auto-close rebase continue popup when rebase completes externally#5252

Open
aofei wants to merge 1 commit intojesseduffield:masterfrom
aofei:fix-rebase-popup-auto-close
Open

fix: auto-close rebase continue popup when rebase completes externally#5252
aofei wants to merge 1 commit intojesseduffield:masterfrom
aofei:fix-rebase-popup-auto-close

Conversation

@aofei
Copy link

@aofei aofei commented Jan 30, 2026

PR Description

When a rebase has conflicts and the user resolves them and runs git rebase --continue in an external terminal, the "Continue rebase?" confirmation popup now automatically dismisses instead of staying visible.

The implementation introduces PopupAutoCloseCondition to tag popups that should auto-close under specific conditions. During status refresh, if the working tree state becomes none (no rebase/merge in progress) and the current popup has matching auto-close condition, the popup is closed.

To allow refresh while the auto-closable popup is showing, the refresh keybinding now uses refreshAllowPopupAutoClose which permits refresh only for popups with an auto-close condition set.

Fixes #5197

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

Manual Test

Steps

# 1. Create test repo with rebase conflict
mkdir test-repo && cd test-repo
git init
echo "original" > file.txt && git add . && git commit -m "initial"
git checkout -b feature
echo "feature" > file.txt && git add . && git commit -m "feature"
git checkout master
echo "master" > file.txt && git add . && git commit -m "master"
git checkout feature
git rebase master  # This will conflict

# 2. Open lazygit in another terminal
lazygit

# 3. Resolve conflict externally (in original terminal)
echo "resolved" > file.txt
git add file.txt
# Wait for "Continue rebase?" popup to appear in lazygit

# 4. Complete rebase externally
git rebase --continue

# 5. Verify: popup should auto-close in lazygit

Expected

The "Continue rebase?" popup automatically dismisses after step 4.

Cleanup

cd .. && rm -rf test-repo

When a rebase has conflicts and the user resolves them and runs
`git rebase --continue` in an external terminal, the "Continue rebase?"
confirmation popup now automatically dismisses instead of staying
visible.

The implementation introduces `PopupAutoCloseCondition` to tag popups
that should auto-close under specific conditions. During status refresh,
if the working tree state becomes none (no rebase/merge in progress) and
the current popup has matching auto-close condition, the popup is
closed.

To allow refresh while the auto-closable popup is showing, the refresh
keybinding now uses `refreshAllowPopupAutoClose` which permits refresh
only for popups with an auto-close condition set.

Fixes jesseduffield#5197

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
Copilot AI review requested due to automatic review settings January 30, 2026 13:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds infrastructure to automatically dismiss certain popups when their triggering condition is no longer true, fixing the “Continue rebase?” confirmation popup persisting after a rebase completes externally (Fixes #5197).

Changes:

  • Introduces PopupAutoCloseCondition and plumbs it through popup option structs and popup creation.
  • Adds refresh-time logic to auto-close popups when the working tree returns to a “no operation in progress” state.
  • Updates the global refresh keybinding to allow refresh while an auto-closable popup is showing, and adds an integration test covering the external git rebase --continue flow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/integration/tests/test_list.go Registers the new integration test in the test suite.
pkg/integration/tests/branch/rebase_conflicts_resolved_externally.go Adds an integration test reproducing the external rebase-continue scenario and asserting the popup dismisses.
pkg/gui/types/common.go Introduces PopupAutoCloseCondition and extends popup option structs to carry it.
pkg/gui/popup/popup_handler.go Passes AutoCloseCondition from ConfirmOpts into CreatePopupPanelOpts; simplifies ConfirmIf to reuse Confirm.
pkg/gui/controllers/helpers/refresh_helper.go Adds auto-close logic during status refresh and a mutex-protected check for current popup opts.
pkg/gui/controllers/helpers/merge_and_rebase_helper.go Marks the “continue rebase” confirmation popups as auto-closable when the working tree state becomes none.
pkg/gui/controllers/global_controller.go Adjusts refresh keybinding to allow refresh when an auto-closable popup is focused.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Continue rebase" confirmation popup not dismissed when rebase is completed externally

1 participant