Re: git diff --functional-changes ?

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

 



Hi Christian,

On Fri, 19 Aug 2022, Christian Heller wrote:

> Feature request
>
> I recently ran GNU indent on a larger C project which made all diffs
> horribly noisy.
> Is there an option for git diff to ignore changes due to the placement
> of curly braces '{', '}' ?
> Equally helpful would be an option to ignore changes to comments.
>
> Something like:
> - delete all comments
> - re-normalize line-breaks and indentation
> - show only 'functional' changes

This would be very language-specific, and if you find a utility that can
do that, you will want to use it in Git via the external diff extension
mechanism:
https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---ext-diff

As far as pure Git goes, I have had luck using the
[--ignore-space-change][space-change] and the [--word-diff][word-diff]
options.

To be honest, I use a custom word diff quite often:
`--word-diff=[A-Za-z0-9_]+|.`. This marks stretches of
alpha-numeric-plus-underscore characters as words, and treats all other
characters as single-character words, too (which means that it also colors
parentheses and such).

Maybe these help you, even if they do not solve precisely for what you
asked.

Ciao,
Johannes

[space-change]: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---ignore-space-change
[word-diff]: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---word-diffltmodegt




[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