6

I can use the gitk tool to view the current changes that have do not committed yet.

But when I update the git from 2.29.2.windows.3 to 2.33.0.windows.2

diff is gone. only show

Local changes checked in to index but not committed

enter image description here


I don't know what happened. I tried to read the release note but couldn't find the answer.


I'm not sure if this is related to the following changes

last commit: 2020/09/11: gitk: replace tabs tith spaces


I don't want to use any replacement tools (like using git gui to view changes); I want gitk to work as well as it used to.

Carson
  • 6,105
  • 2
  • 37
  • 45
  • Do you have unstaged changes ? In a terminal, what does `git status -s` show ? Does `git diff` display anything ? – LeGEC Sep 26 '21 at 16:43
  • 1
    Hi @LeGEC, It show `new file: .gitmodules`, `modified: README.md`, ... and neither one show the diff, but it does work in 2.29.2 – Carson Sep 26 '21 at 16:47
  • 5
    This is a regression (bug) in `git-diff-index` that will be fixed in the next release. – j6t Sep 26 '21 at 16:48
  • @j6t, Thank you for getting back to me so quickly and giving me an answer. – Carson Sep 26 '21 at 17:58
  • I am very new to the git forum. If anyone wants to have a deeper understanding of git, I think it would be helpful to join some discussions. Here are some links I found ● https://git-scm.com/community ● [git-for-windows/issues](https://github.com/git-for-windows/git/issues) ● [groups.google](https://groups.google.com/g/git-users/) ● [marc.info/?l=git](https://marc.info/?l=git&m=163103876304855&w=2) – Carson Sep 26 '21 at 17:58

2 Answers2

5

As j6t noted in a comment, this is a bug in the current versions of Git, scheduled to be fixed in an upcoming release.

Technically, the issue has to do with gitk using the --cc option every time. This used to work for git diff-index, with the --cc being ignored when the index is not in conflicted state, and the --cc producing a combined diff when the index is in a conflicted state (i.e., when you have an unresolved merge). Now git diff-index --cc produces an error message and quits, and gitk thinks that this means there are no unstaged changes.

(The --cc option to git diff-index was never documented and was accidentally removed, instead of becoming documented. This shows why it's dangerous to depend on undocumented behavior: you can't tell if it was intended. It probably was, in this case, but the person who improved git diff handling for merges didn't know this.)

torek
  • 448,244
  • 59
  • 642
  • 775
  • Thanks, I localy edited my gitk script and removed any reference to `--cc` and it now works again. Probably displayed wrong for conflicts, but I don’t use gitk when there are conflicts, only command line. – Cyrille Pontvieux Oct 07 '21 at 07:27
3

git 2.33.1 has fixed this problem.

Recent "diff -m" changes broke "gitk", which has been corrected.

Carson
  • 6,105
  • 2
  • 37
  • 45