Skip to content

Git - refactor create/delete worktree and expose extension API - #278107

Merged
Ladislau Szomoru (lszomoru) merged 3 commits into
mainfrom
lszomoru/mechanical-hoverfly
Nov 18, 2025
Merged

Ladislau Szomoru (lszomoru) merged 3 commits into
mainfrom
lszomoru/mechanical-hoverfly

Conversation

@lszomoru

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors worktree creation and deletion functionality by moving the core logic from commands.ts to repository.ts and exposing a new extension API for worktree management.

Key Changes:

  • Introduces createWorktree() and deleteWorktree() methods in the Repository class with flexible options for path, commitish, and branch
  • Exposes these methods through the Git extension API for use by other extensions
  • Refactors command handler to use the new repository methods, extracting helper methods for better code organization

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
extensions/git/src/repository.ts Adds createWorktree() method with automatic branch name generation, path resolution, and state management; implements getRandomBranchName() helper for random branch naming
extensions/git/src/commands.ts Refactors createWorktree command to delegate to repository method; extracts getWorktreeCommitishAndBranch() and getWorktreePath() helper methods; removes createWorktreeWithDefaults command
extensions/git/src/api/git.d.ts Adds createWorktree() and deleteWorktree() to the public Repository interface
extensions/git/src/api/api1.ts Implements API wrapper methods that delegate to the internal repository implementation

Comment thread extensions/git/src/repository.ts Resolved
Comment thread extensions/git/src/repository.ts Resolved
Comment thread extensions/git/src/commands.ts Resolved
@lszomoru
Ladislau Szomoru (lszomoru) deleted the lszomoru/mechanical-hoverfly branch November 18, 2025 15:37
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jan 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

git GIT issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants