microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.61k stars 29.42k forks source link

git Source Control Graph fails to load if branch is tracking another local branch #234396

Open rkjnsn opened 10 hours ago

rkjnsn commented 10 hours ago

In git, sometimes it is useful to have a local branch track another local branch. When such a branch is created, git will use the special value . for the remote field. E.g., if feature2 depends on feature1, I might set the feature2 branch to track the feature1 branch for ease of rebasing as I make adjustments to feature1. The resulting .git/config entry would look like this:

[branch "feature2"]
        remote = .
        merge = refs/heads/feature1

However, when I have the feature2 branch checked out, I see no history in the source control graph. Instead it tells me,

The selected source control provider does not have any source control history items.

Looking at the Git output panel, I see the following error:

fatal: bad revision 'refs/remotes/./feature1'

The problem seems to be that VS Code doesn't recognize that . is a special value meaning "the local repository", not the name of a remote.

The correct behavior would be instead to query refs/heads/feature1 when the remote is ..

Version: 1.95.3 Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813 User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Embedder: server-distro