Re: git-diff: --ignore-matching-lines has no effect on the output when --name-only is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi@arnes.space writes:
> 
> I discovered that diff output is not filtered when the `--name-only`
> flag is given, it always lists all affected files. Is this a known bug?
> I could not find anything in the documentation.
> 
> Perhaps related, `--ignore-matching-lines` is ignored by my external
> diff helper difftastic[1]. I'm not sure if this is an upstream issue, or
> if the way external diff helpers are implemented is related to this at all.

The `—ignore-matching-lines` options is introduced in 296d4a94e72
(Michał Kępień 2020-10-20 08:48:09 +0200 5803) Since the Git documentation
doesn't specify how git diff --ignore-matching-lines=<regex>
is supposed to behave when used with --name-only, I'm not sure whether
this is a bug. However, I'm confident that this is not an issue with your diff tool.
The reason is that git diff uses the built-in diffcore_std() to filter out diff file pairs
that shouldn't be output. However, in the latest Git source code, diffcore_std()
does not filter file pairs based on ignore_regex.

It appears that ignore_regex only takes effect when using the built-in diff (builtin_diff).
I'm not entirely certain about this, but if that's the case, then regardless of whether
your external diff tool supports --ignore-matching-lines or not, this option is likely
to have no effect when using an external diff.

> 
> The behavior can be observed in git 2.49.0 using `git diff --no-ext-diff
> --name-only --ignore-matching-lines`.
> 
> Best,
> Arne
> 
> [1]: https://difftastic.wilfred.me.uk/

Cool diff tool

Thanks,
Lidong






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux