Open bluenote10 opened 1 year ago
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
.
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 🤔
Description
my_other_feature_branch
.git diff my_other_feature_branch
lists.ALT
+F5
to cycle through changes has no effect). This seems to be wrong, becausegit diff my_other_feature_branch
clearly 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