git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: gitk regression in version 2.36.0

From
René Scharfe <l.s.r@web.de>
Date
Apr 23, 2022, 09:27 UTC
Message-ID
<8424860b-e557-55b1-49a0-246a2eb112d4@web.de>
In-Reply-To
<AM0PR04MB6019ECF053F1FB7B29D75AB7A5F69@AM0PR04MB6019.eurprd04.prod.outlook.com>
Am 23.04.22 um 07:25 schrieb Matthias Aßhauer:
Show 30 quoted lines
> 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

gitk does something like this to find commits that touched that file (just with more commits):

   # v2.25.3
   $ git rev-parse 4c53a8c20f ff5b7913f0 | git diff-tree -r -s --stdin GIT-VERSION-GEN
   4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a
   # 244c27242f (diff.[ch]: have diff_free() call clear_pathspec(opts.pathspec), 2022-02-16))
   $ git rev-parse 4c53a8c20f ff5b7913f0 | git diff-tree -r -s --stdin GIT-VERSION-GEN
   4c53a8c20f8984adb226293a3ffd7b88c3f4ac1a
   ff5b7913f0af62c26682b0376d0aa2d7f5d74b2e

Somewhere in diff-tree a struct diff_options is reused between commits, and the caller expects its pathspec to be preserved, but 244c27242f clears it. With the path filter gone, the following commits match.

René
Previous: Junio C Hamano
Message 16 of 16 in “gitk regression in version 2.36.0”
  1. Matthias AßhauerApr 23, 2022
  2. Junio C HamanoApr 23, 2022
  3. Junio C HamanoApr 23, 2022
  4. René ScharfeApr 23, 2022
  5. Junio C HamanoApr 23, 2022
  6. 2.36 gitk/diff-tree --stdin regression fixJunio C Hamano, Apr 25, 2022
  7. t4013: diff-tree --stdin with pathspecJunio C Hamano, Apr 25, 2022
  8. Phillip WoodApr 26, 2022
  9. Phillip WoodApr 26, 2022
  10. Junio C HamanoApr 26, 2022
  11. Junio C HamanoApr 26, 2022
  12. 2.36 gitk/diff-tree --stdin regression fixJunio C Hamano, Apr 26, 2022
  13. René ScharfeApr 27, 2022
  14. René ScharfeApr 27, 2022
  15. Junio C HamanoApr 27, 2022
  16. René ScharfeApr 23, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.