Skip to content
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

git worktree repo branch shows incorrectly #165425

Closed
cyrusdaboo opened this issue Nov 3, 2022 · 3 comments
Closed

git worktree repo branch shows incorrectly #165425

cyrusdaboo opened this issue Nov 3, 2022 · 3 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@cyrusdaboo
Copy link

Type: Bug

After the latest update, when I look at the Source Control Repository view, the branch name for repos that are worktrees is wrong - it shows the name of the main git repo.

To reproduce:

  1. Checkout a git repo to branch A
  2. Create a git worktree for branch B and add folder to VSCode
  3. Go to Source Control Repository view
  4. Result both repos show branch A.

VS Code version: Code 1.73.0 (Universal) (8fa188b, 2022-11-01T15:38:50.881Z)
OS version: Darwin arm64 22.2.0
Modes:
Sandboxed: No

@remigourdon
Copy link

remigourdon commented Nov 3, 2022

I can confirm the bug after upgrading to the latest release.

I also think it's more than just a visual bug since when I try to commit a change on a worktree branch (different from the default branch) using the Source Control Repository view and with git.branchProtectionPrompt set to alwaysPrompt, I get prompted as if I was about to commit on my default branch (protected), even though a git branch in the terminal confirms I am not on my default branch.

@BlaM
Copy link

BlaM commented Nov 4, 2022

Steps to reproduce: (via Windows cmd - not sure if we see the same problem in other OS)

mkdir test
cd test
git init
echo test >test
git add test
git commit -m "test-commit in master branch"
git worktree add ../bla -b bla

This will create a new repository in a directory called "test", then adds a dummy commit into the master branch and finally creates a worktree directory in the directory "bla" alongside "test" where it checks out a new branch "bla". When opening the folder "bla" in VS Code you will see "master" as the checked out branch (which is actually checked out in "test").

@lszomoru
Copy link
Member

lszomoru commented Nov 4, 2022

Duplicate of #164363

@lszomoru lszomoru marked this as a duplicate of #164363 Nov 4, 2022
@lszomoru lszomoru closed this as completed Nov 4, 2022
@lszomoru lszomoru added the *duplicate Issue identified as a duplicate of another issue(s) label Nov 4, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

No branches or pull requests

5 participants