-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Source Control menu showing wrong branches of worktrees contained in bare repository #164363
Comments
I'm having the same issue with a non-bare repository. I have an additional worktree and today's VSCode update is showing the checked out branch of the main worktree instead of the current directory's worktree. This worked fine in v1.72, and is now broken in v1.73. This also messes up the GitHub Pull Requests extension since it is using the wrong branch to get PR information. |
This was working correctly in the prior version, but today when I applied the newly available v1.73 I am seeing this problem is all my secondary worktrees. |
This appears to be caused by #162572, specifically here where it's getting the vscode/extensions/git/src/git.ts Line 2086 in 9c80241
diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts
index 7c49b545f8c..1538a356a31 100644
--- a/extensions/git/src/git.ts
+++ b/extensions/git/src/git.ts
@@ -2083,7 +2083,7 @@ export class Repository {
}
async getHEADFS(): Promise<Ref> {
- const raw = await fs.readFile(path.join(this.dotGit.commonPath ?? this.dotGit.path, 'HEAD'), 'utf8');
+ const raw = await fs.readFile(path.join(this.dotGit.path ?? this.dotGit.commonPath, 'HEAD'), 'utf8');
// Branch
const branchMatch = raw.match(/^ref: refs\/heads\/(?<name>.*)$/m); |
I have the same problem with VS Code 1.73.0. This issue also breaks GitLab extension since it gets wrong branch. I downgrad to 1.72.2 to avoid this issue temporarily. If anyone needs it, the download link is: |
Can the builtin extensions be updated independently from updating vscode? In that case this shouldn't be hard to fix. |
@brainz80, it cannot. I am looking at having this fixed in Insiders early next week. |
I'm having this same issue in 1.73.0 (user setup). I've got 3 repositories each having 4 active git-worktrees in a multi-root workspace, and each worktree seems to indicate the same checked out branch. |
I'm also having a problem in 1.73.0 that appears to be the same root cause. This is causing problems for the GitHub Pull Requests and Issues extension (I can only review PRs when using the primary working tree). |
yep, me too! |
same issue |
The fix will be included into Monday's Insiders release. Apologies for the inconvenience. |
I appreciate the quick fix! Thank you. |
@lszomoru Any idea when this will be in the regular release? I'd rather not have to switch to the insiders build. |
Verification steps:
Expected: VS Code status indicator should show |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
git clone --bare git@github.com:microsoft/vscode.git
)cd vscode.git
)trees
folder in the bare repository folder. (ex:mkdir trees
)git worktree add trees/1.70 release/1.70; git worktree add trees/1.71 release/1.71; git worktree add trees/1.72 release/1.72
)trees/1.70
,trees/1.71
, andtrees/1.72
to a VSCode workspace.main
but should berelease/1.70
,release/1.71
, andrelease/1.72
)Screenshot included is from the example instructions above where none of these folders have
main
checked out, yet all showmain
as their checked out branch:I can confirm that the correct branch names were displayed at least as of 1.70.2 but I have not yet tried more versions in-between.
The text was updated successfully, but these errors were encountered: