From 995b9ad6430ab068eb68b906c0ee16efb9ba71d6 Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Thu, 9 Apr 2026 04:16:12 +0000 Subject: [PATCH] git: use dotGit.path for MERGE_MSG and SQUASH_MSG in linked worktrees In linked worktrees, the worktree-specific gitdir (dotGit.path) contains the MERGE_MSG and SQUASH_MSG files, not the common gitdir. Previously, getMergeMessage() and getSquashMessage() constructed paths using `path.join(repositoryRoot, '.git', ...)`, which points to a file (the .git file redirector) rather than a directory in linked worktrees, causing fs.readFile to fail and the commit message input box to remain empty during a merge or squash in a worktree. Fix both methods to use dotGit.path directly, which is already set to the worktree-specific gitdir for linked worktrees and the main .git directory for normal repositories. --- extensions/git/src/git.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 7b7d9be3eda16..6fa58e338d5a1 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -3257,7 +3257,7 @@ export class Repository { } async getSquashMessage(): Promise { - const squashMsgPath = path.join(this.repositoryRoot, '.git', 'SQUASH_MSG'); + const squashMsgPath = path.join(this.dotGit.path, 'SQUASH_MSG'); try { const raw = await fs.readFile(squashMsgPath, 'utf8'); @@ -3268,7 +3268,7 @@ export class Repository { } async getMergeMessage(): Promise { - const mergeMsgPath = path.join(this.repositoryRoot, '.git', 'MERGE_MSG'); + const mergeMsgPath = path.join(this.dotGit.path, 'MERGE_MSG'); try { const raw = await fs.readFile(mergeMsgPath, 'utf8');