Skip to content

Improves handling of 'delete worktree' action on merge target when the default worktree is already open #4245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

axosoft-ramint
Copy link
Contributor

#4232

When using the "delete worktree" action on the merge target hover, closes the current window and hands the rest of the flow over to the existing window with the default worktree, whenever it exists already.

To make this happen:

  1. Fixes a bug in findCommonRepository where we are passing a '.git' folder path into the lower-level rev-parse git ops, which ultimately results in an error from git (to repro in any terminal, navigate to the .git directory of a repo and try git rev-parse --show-toplevel. You will see a fatal: this operation must be run in a work tree error.)
  2. Pending deep links are moved to secret storage so that GitLens in other windows can detect when they are stored externally.
  3. A listener is added to the deep link service to respond to pending deep links in storage whenever they match a repo open in the current window, and for the time being, only for pending deep links with the "delete worktree" action, to minimize possible regression risk.
  4. A delayed command is triggered to close the window that initiated the handoff.

This carries a great deal of regression risk with deep links, so we should check for regressions where we can.

Closes #4232

Copy link
Member

@d13 d13 left a comment

Choose a reason for hiding this comment

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

LGTM

@axosoft-ramint axosoft-ramint merged commit 6a49a22 into main Apr 23, 2025
3 checks passed
@axosoft-ramint axosoft-ramint deleted the 4232-attemping-to-delete-the-current-worktree-from-home-fails-if-the-default-worktree-is-already-open branch April 23, 2025 14:56
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.

Attemping to delete the current worktree from Home fails if the default worktree is already open
3 participants