Re: [PATCH] 2.36 gitk/diff-tree --stdin regression fix
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 27, 2022, 20:03 UTC
- Message-ID
- <xmqqv8uul2ea.fsf@gitster.g>
- In-Reply-To
- <a1dcac11-98ac-9fcd-8375-4fd1be9ace78@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 8 quoted lines
>> + if (prev_options_with_pathspec == options && !options->pathspec.nr)
>> + BUG("reused struct diff_options, potentially lost pathspec");
>> + if (options->pathspec.nr)
>> + prev_options_with_pathspec = options;
>
> This can report a false positive if a diffopt is reused with different
> pathspecs, and one of them is empty (match all). Which could be countered
> by using a fresh diffopt every time (e.g. pushing it into a loop).The only use case to reset pathspec of a diffopt during iteration I can think of is the hacky[*] version of "git log --follow" where the pathspec is swapped when a rename of a single path being followed is detected.
Side note: hacky because the way it swaps a single pathspec upon
seeing one rename means it does not work in a mergy-branchy
history where one branch renames and there are still commits
that need to be explored on the other branch that had the path
under its original name.