Git 2.36.0 (or more precisely 244c27242f (diff.[ch]: have diff_free() call
clear_pathspec(opts.pathspec), 2022-02-16)) introduced some change in
behaviour that causes gitks highlight feature not to work correctly
anymore.
Here's a quick reproducer based on git.git:
git checkout 244c27242f44e6b88e3a381c90bde08d134c274b~1
make install
git checkout 244c27242f44e6b88e3a381c90bde08d134c274b
PATH=~/bin:$PATH ~/bin/gitk
# In commit 4c53a8c20f (Git 2.35.1, 2022-01-28) (2nd from the top)
# right click GIT-VERSION-GEN and select "Highlight this only".
# You'll see 4c53a8c20f (Git 2.35.1, 2022-01-28) and
# 89bece5c8c (Git 2.35, 2022-01-24) highlighted, but not the surrounding
# commits. Exit gitk.
make install
PATH=~/bin:$PATH ~/bin/gitk
# In commit 4c53a8c20f (Git 2.35.1, 2022-01-28) (2nd from the top)
# right click GIT-VERSION-GEN and select "Highlight this only".
# Almost every non-merge commmit will be highlighted.
I think this is a change in behaviour in `git diff-tree`, but I'm honestly
not sure what arguments gitk passes to `git diff-tree`, so I'm struggling
to figure out what exactly changed.
This issue was originally reported as a Git for Windows issue [1], but I
can also reproduce it on Linux.
[1] https://github.com/git-for-windows/git/issues/3815