Search and compare: Sometimes no changes are shown for files that do have changes
Description
- In "Search & Compare" I select "Compare References".
- In the dropdown I select "Working Tree".
- In the next dropdown I select e.g.
my_other_feature_branch. - Now the "Search & Compare" view shows a subtree say "X files have changed". This list seems correct, i.e., in line with what
git diff my_other_feature_branchlists. - When clicking on the files, the diff view opens, but it shows no changes at all (and pressing
ALT+F5to cycle through changes has no effect). This seems to be wrong, becausegit diff my_other_feature_branchclearly shows changes between the two branches for the particular file. Both the left and the right side show the state that correspond to the HEAD/working directory, even though one of them should be different, because the file is different onmy_other_feature_branch(note: The header of the tab does show a hash for the left-hand-side file, but none for the right-hand-side file, which seems okay). For some reason, this issue happens only for certain files. In some case the diff is correct.
GitLens Version
13.5.0
VS Code Version
Version: 1.77.3 Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710 Date: 2023-04-12T09:16:52.732Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Linux x64 5.4.0-146-generic Sandboxed: No
Git Version
git version 2.25.1
Logs, Screenshots, Screen Captures, etc
No response
Hello Bluenote,
Can you please enable debug logging by running the GitLens: Enable Debug Logging command from the Command Palette (F1 or ctrl/cmd+shift+p). This will enable logging to the GitLens & GitLens (Git) channels in the Output pane. Once enabled, please reproduce the issue, and attach the logs from the GitLens and GitLens (Git) channels. Thank you!
@bluenote10 Logs might help some, but a video/Gif of what you are seeing would be very helpful. Or a better yet a reproducible case -- as I use the "Compare Working Tree with
Yes, the functionality also works for me most of the time. I was just trying to reproduce it in a publicly available repository, but all attempts on the repos/branches I tried worked so far. The particular repo were the issue occurs is a repository on which I'm not allowed to disclose any information. So it will be tricky to provide anything reproducible, but I'll see what I can do.
Logs might help some, but a video/Gif of what you are seeing would be very helpful.
The video would literally just show a side-by-side diff view but without any visible diffs (after clicking on one of the affected files that are listed as files with changes) -- not so much insight from that except that it just doesn't work in this particular case.
Okay, I think I have found a minimal reproducible example.
First, let's setup a minimal repository with a branch named main:
mkdir test_repo
cd test_repo
git init
git checkout -b main
cat > some_file.txt <<EOL
Some file with example content.
The file contains two sections so that we can create a git merge
without a conflict.
Section A:
- 1
- 2
- 3
Section B:
- 1
- 2
- 3
EOL
git add .
git commit -m "initial commit"
Now, let's create a feature branch called foo that modifies section A in that file:
git checkout -b foo
cat > some_file.txt <<EOL
Some file with example content.
The file contains two sections so that we can create a git merge
without a conflict.
Section A:
- 1
- 2
- 3
- 4
Section B:
- 1
- 2
- 3
EOL
git add .
git commit -m "modified section A on branch foo"
Now, let's simulate a simultaneous change of that file but in section B on the main branch:
git checkout main
cat > some_file.txt <<EOL
Some file with example content.
The file contains two sections so that we can create a git merge
without a conflict.
Section A:
- 1
- 2
- 3
Section B:
- 1
- 2
- 3
- 4
EOL
git add .
git commit -m "modified section B on branch main"
Now let's merge the change on main back into the foo branch.
git checkout foo
git merge main
Note that on the foo branch now both sections are modified, because we have combined the two changes.
Now let's create a new feature branch called bar that branches off of main:
git checkout main
git checkout -b bar
From here you can use GitLens and do the "compare working set with" and select the foo branch to compare aginst. The "Search & Compare" tree view will show the file as modified, but when clicking on the file no change is visible. Both sides of the view show:
Some file with example content.
The file contains two sections so that we can create a git merge
without a conflict.
Section A:
- 1
- 2
- 3
Section B:
- 1
- 2
- 3
- 4
But that is wrong, because section A on branch foo has been modified (it contains a 4th element). Using git diff foo on branch bar properly shows the diff between bar and foo.
Debug log of `GitLens` channel
[2023-05-10 06:50:00.310] [ 10f] GitProviderService.getBestRepository(e=undefined, t=undefined)
[2023-05-10 06:50:00.310] [ 10f] GitProviderService.getBestRepository(e=undefined, t=undefined) returned /tmp/reproduction_gitlens_issue/test_repo • 0 ms
[2023-05-10 06:50:00.311] [ 110] SearchAndCompareViewNode.triggerChange
[2023-05-10 06:50:00.311] [ 111] SearchAndCompareView.refreshNode(e=SearchAndCompareViewNode, t=false, i=false)
[2023-05-10 06:50:00.311] [ 112] SearchAndCompareViewNode.refresh(false)
[2023-05-10 06:50:00.311] [ 112] SearchAndCompareViewNode.refresh(false) completed • 0 ms
[2023-05-10 06:50:00.311] [ 113] SearchAndCompareView.triggerNodeChange(e=SearchAndCompareViewNode)
[2023-05-10 06:50:00.311] [ 113] SearchAndCompareView.triggerNodeChange(e=SearchAndCompareViewNode) completed • 0 ms
[2023-05-10 06:50:00.312] [ 111] SearchAndCompareView.refreshNode(e=SearchAndCompareViewNode, t=false, i=false) completed • 0 ms
[2023-05-10 06:50:00.312] [ 110] SearchAndCompareViewNode.triggerChange completed • 0 ms
[2023-05-10 06:50:00.312] [ 114] SearchAndCompareView.reveal(e=ComparePickerNode, t={"focus":false,"select":true})
[2023-05-10 06:50:00.367] [ 114] SearchAndCompareView.reveal(e=ComparePickerNode, t={"focus":false,"select":true}) completed • 54 ms
[2023-05-10 06:50:00.367] [ 115] GitProviderService.getRepository(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:00.367] [ 115] GitProviderService.getRepository(e=/tmp/reproduction_gitlens_issue/test_repo) returned /tmp/reproduction_gitlens_issue/test_repo • 0 ms
[2023-05-10 06:50:00.367] [ 116] GitProviderService.getBranches(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:00.367] [ 117] LocalGitProvider.getBranches(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:00.368] [ 118] GitProviderService.getTags(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:00.368] [ 119] LocalGitProvider.getTags(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:00.368] [ 11a] GitProviderService.getRepository(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:00.368] [ 11a] GitProviderService.getRepository(e=/tmp/reproduction_gitlens_issue/test_repo) returned /tmp/reproduction_gitlens_issue/test_repo • 0 ms
[2023-05-10 06:50:00.369] [ 117] LocalGitProvider.getBranches(e=/tmp/reproduction_gitlens_issue/test_repo) completed • 1 ms
[2023-05-10 06:50:00.369] [ 119] LocalGitProvider.getTags(e=/tmp/reproduction_gitlens_issue/test_repo) completed • 1 ms
[2023-05-10 06:50:00.369] [ 116] GitProviderService.getBranches(e=/tmp/reproduction_gitlens_issue/test_repo) completed • 1 ms
[2023-05-10 06:50:00.369] [ 118] GitProviderService.getTags(e=/tmp/reproduction_gitlens_issue/test_repo) completed • 1 ms
[2023-05-10 06:50:03.266] [ 120] SearchAndCompareViewNode.triggerChange
[2023-05-10 06:50:03.266] [ 121] SearchAndCompareView.refreshNode(e=SearchAndCompareViewNode, t=false, i=false)
[2023-05-10 06:50:03.266] [ 122] SearchAndCompareViewNode.refresh(false)
[2023-05-10 06:50:03.266] [ 124] SearchAndCompareView.triggerNodeChange
[2023-05-10 06:50:03.266] [ 124] SearchAndCompareView.triggerNodeChange completed • 0 ms
[2023-05-10 06:50:03.267] [ 122] SearchAndCompareViewNode.refresh(false) completed • 0 ms
[2023-05-10 06:50:03.267] [ 125] SearchAndCompareView.reveal(e=y(gitlens:repository(/tmp/reproduction_gitlens_issue/test_repo):compare-results(|foo):2), t={"expand":true,"focus":true,"select":true})
[2023-05-10 06:50:03.267] [ 126] SearchAndCompareView.triggerNodeChange(e=SearchAndCompareViewNode)
[2023-05-10 06:50:03.267] [ 126] SearchAndCompareView.triggerNodeChange(e=SearchAndCompareViewNode) completed • 0 ms
[2023-05-10 06:50:03.268] [ 121] SearchAndCompareView.refreshNode(e=SearchAndCompareViewNode, t=false, i=false) completed • 1 ms
[2023-05-10 06:50:03.268] [ 120] SearchAndCompareViewNode.triggerChange completed • 1 ms
[2023-05-10 06:50:03.344] [ 127] GitProviderService.getAheadBehindCommitCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=HEAD...foo)
[2023-05-10 06:50:03.344] [ 128] LocalGitProvider.getAheadBehindCommitCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=HEAD...foo)
[2023-05-10 06:50:03.354] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git rev-list --left-right --count HEAD...foo -- • 9 ms
[2023-05-10 06:50:03.355] [ 128] LocalGitProvider.getAheadBehindCommitCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=HEAD...foo) completed • 10 ms
[2023-05-10 06:50:03.355] [ 127] GitProviderService.getAheadBehindCommitCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=HEAD...foo) completed • 10 ms
[2023-05-10 06:50:03.355] [ 129] GitProviderService.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo, r={"forkPoint":true})
[2023-05-10 06:50:03.355] [ 12a] LocalGitProvider.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo, r={"forkPoint":true})
[2023-05-10 06:50:03.364] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git merge-base --fork-point foo • 8 ms
[2023-05-10 06:50:03.364] [ 12a] LocalGitProvider.getMergeBase
Error: Command failed: /usr/bin/git -c core.quotepath=false -c color.ui=false merge-base --fork-point foo
fatal: No such ref: ''
[2023-05-10 06:50:03.364] [ 12a] LocalGitProvider.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo, r={"forkPoint":true}) completed • 9 ms
[2023-05-10 06:50:03.364] [ 129] GitProviderService.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo, r={"forkPoint":true}) completed • 9 ms
[2023-05-10 06:50:03.364] [ 12b] GitProviderService.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo)
[2023-05-10 06:50:03.364] [ 12c] LocalGitProvider.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo, r=undefined)
[2023-05-10 06:50:03.371] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git merge-base foo • 6 ms
[2023-05-10 06:50:03.372] [ 12c] LocalGitProvider.getMergeBase
Error: Command failed: /usr/bin/git -c core.quotepath=false -c color.ui=false merge-base foo
fatal: Not a valid object name
[2023-05-10 06:50:03.372] [ 12c] LocalGitProvider.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo, r=undefined) completed • 7 ms
[2023-05-10 06:50:03.372] [ 12b] GitProviderService.getMergeBase(e=/tmp/reproduction_gitlens_issue/test_repo, t=, i=foo) completed • 7 ms
[2023-05-10 06:50:03.373] [ 12d] GitProviderService.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"..foo"})
[2023-05-10 06:50:03.373] [ 12e] LocalGitProvider.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"..foo"})
[2023-05-10 06:50:03.374] [ 12f] GitProviderService.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"foo.."})
[2023-05-10 06:50:03.374] [ 130] LocalGitProvider.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"foo.."})
[2023-05-10 06:50:03.375] [ 131] GitProviderService.getDiffStatus(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo)
[2023-05-10 06:50:03.375] [ 132] LocalGitProvider.getDiffStatus(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo, i=undefined, r=undefined)
[2023-05-10 06:50:03.375] [ 133] GitProviderService.getChangedFilesCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo)
[2023-05-10 06:50:03.375] [ 134] LocalGitProvider.getChangedFilesCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo)
[2023-05-10 06:50:03.397] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git diff --name-status -M --no-ext-diff -z foo -- • 22 ms
[2023-05-10 06:50:03.397] [ 135] GitDiffParser.parseNameStatus completed • 0 ms
[2023-05-10 06:50:03.397] [ 132] LocalGitProvider.getDiffStatus(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo, i=undefined, r=undefined) completed • 22 ms
[2023-05-10 06:50:03.397] [ 131] GitProviderService.getDiffStatus(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo) completed • 22 ms
[2023-05-10 06:50:03.397] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git log --format=%x3c%x2ff%x3e%n%x3cr%x3e%x20%H%n%x3ca%x3e%x20%aN%n%x3ce%x3e%x20%aE%n%x3cd%x3e%x20%at%n%x3cn%x3e%x20%cN%n%x3cm%x3e%x20%cE%n%x3cc%x3e%x20%ct%n%x3cp%x3e%x20%P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -M -m --name-status --full-history -n201 foo.. -- • 23 ms
[2023-05-10 06:50:03.397] [ 136] LocalGitProvider.getCurrentUser(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:03.398] [ 136] LocalGitProvider.getCurrentUser(e=/tmp/reproduction_gitlens_issue/test_repo) completed • 0 ms
[2023-05-10 06:50:03.398] [ 137] ee.parse
[2023-05-10 06:50:03.398] [ 137] ee.parse completed • 0 ms
[2023-05-10 06:50:03.398] [ 130] LocalGitProvider.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"foo.."}) completed • 23 ms
[2023-05-10 06:50:03.398] [ 12f] GitProviderService.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"foo.."}) completed • 23 ms
[2023-05-10 06:50:03.398] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git log --format=%x3c%x2ff%x3e%n%x3cr%x3e%x20%H%n%x3ca%x3e%x20%aN%n%x3ce%x3e%x20%aE%n%x3cd%x3e%x20%at%n%x3cn%x3e%x20%cN%n%x3cm%x3e%x20%cE%n%x3cc%x3e%x20%ct%n%x3cp%x3e%x20%P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -M -m --name-status --full-history -n201 ..foo -- • 25 ms
[2023-05-10 06:50:03.398] [ 138] LocalGitProvider.getCurrentUser(e=/tmp/reproduction_gitlens_issue/test_repo)
[2023-05-10 06:50:03.398] [ 138] LocalGitProvider.getCurrentUser(e=/tmp/reproduction_gitlens_issue/test_repo) completed • 0 ms
[2023-05-10 06:50:03.398] [ 139] ee.parse
[2023-05-10 06:50:03.398] [ 139] ee.parse completed • 0 ms
[2023-05-10 06:50:03.399] [ 12e] LocalGitProvider.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"..foo"}) completed • 25 ms
[2023-05-10 06:50:03.399] [ 12d] GitProviderService.getLog(e=/tmp/reproduction_gitlens_issue/test_repo, t={"limit":200,"ref":"..foo"}) completed • 26 ms
[2023-05-10 06:50:03.399] [GIT ] [/tmp/reproduction_gitlens_issue/test_repo] git diff --shortstat --no-ext-diff foo -- • 24 ms
[2023-05-10 06:50:03.399] [ 13a] GitDiffParser.parseShortStat completed • 0 ms
[2023-05-10 06:50:03.399] [ 134] LocalGitProvider.getChangedFilesCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo) completed • 24 ms
[2023-05-10 06:50:03.399] [ 133] GitProviderService.getChangedFilesCount(e=/tmp/reproduction_gitlens_issue/test_repo, t=foo) completed • 24 ms
[2023-05-10 06:50:03.426] [ 125] SearchAndCompareView.reveal(e=y(gitlens:repository(/tmp/reproduction_gitlens_issue/test_repo):compare-results(|foo):2), t={"expand":true,"focus":true,"select":true}) completed • 158 ms
Debug log of `GitLens (Git)` channel
[2023-05-10 06:50:03.354] [ 9ms] [/tmp/reproduction_gitlens_issue/test_repo] git rev-list --left-right --count HEAD...foo --
[2023-05-10 06:50:03.364] [ 8ms] [/tmp/reproduction_gitlens_issue/test_repo] git merge-base --fork-point foo
[2023-05-10 06:50:03.371] [ 6ms] [/tmp/reproduction_gitlens_issue/test_repo] git merge-base foo
[2023-05-10 06:50:03.397] [ 22ms] [/tmp/reproduction_gitlens_issue/test_repo] git diff --name-status -M --no-ext-diff -z foo --
[2023-05-10 06:50:03.397] [ 23ms] [/tmp/reproduction_gitlens_issue/test_repo] git log --format=%x3c%x2ff%x3e%n%x3cr%x3e%x20%H%n%x3ca%x3e%x20%aN%n%x3ce%x3e%x20%aE%n%x3cd%x3e%x20%at%n%x3cn%x3e%x20%cN%n%x3cm%x3e%x20%cE%n%x3cc%x3e%x20%ct%n%x3cp%x3e%x20%P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -M -m --name-status --full-history -n201 foo.. --
[2023-05-10 06:50:03.398] [ 25ms] [/tmp/reproduction_gitlens_issue/test_repo] git log --format=%x3c%x2ff%x3e%n%x3cr%x3e%x20%H%n%x3ca%x3e%x20%aN%n%x3ce%x3e%x20%aE%n%x3cd%x3e%x20%at%n%x3cn%x3e%x20%cN%n%x3cm%x3e%x20%cE%n%x3cc%x3e%x20%ct%n%x3cp%x3e%x20%P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e -M -m --name-status --full-history -n201 ..foo --
[2023-05-10 06:50:03.399] [ 24ms] [/tmp/reproduction_gitlens_issue/test_repo] git diff --shortstat --no-ext-diff foo --
EDIT: Apparently the reproduction steps above do not always lead to the problem. I tried it 5 times now, and in 2 out of them I ended up with the problem appearing, but in the other 3 attempts it works fine. Is it possible that it has something to do with what exact hash values git has generated?
Any update on this? For me the "compare and search" feature is basically unusable, because GitLens constantly shows "no diff" where there actually is a diff. I'm wondering why nobody cares about that -- it seems such a fundamental bug 🤔
Ran into similar issues of late. Diff started showing after clearing the VSCode OUTPUT for GitLens.
In the recent release we've made lots of improvements to the internals of GitLens and I am unable to reproduce this issue (following the steps above).
Can you please see if this issue is still reproducible in the pre-release edition of GitLens? Thanks!
You can switch to the pre-release edition of GitLens, by clicking on the "Switch to Pre-Release version of this extension" from the Extensions view.

This issue needs more information and has not had recent activity. Please provide the missing information or it will be closed in 7 days. Thanks!
Closing this issue because it needs more information and has not had recent activity. Please re-open this issue if more details can be provided. Thanks!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.