how to ignore whitespace changes with --color-moved (git diff move detection)?

3 messages, 3 authors, 2018-02-02 · open the first message on its own page

how to ignore whitespace changes with --color-moved (git diff move detection)?

From: Timothee Cour <hidden>
Date: 2018-02-02 02:14:30

this PR from october 2017 was discussing a patch that'd introduce
`--color-moved-[no-]ignore-space-change`
https://public-inbox.org/git/20171025224620.27657-3-sbeller@google.com/

however not sure what happened since then as I can't find in `git help
diff` options even after `brew install --HEAD git`

it's a really useful feature as it's a common use case (ppl move
blocks and reformat in same PR)

If it's not merged in git repo yet is there an easy way to try out
this feature? (even if experimental)

Re: how to ignore whitespace changes with --color-moved (git diff move detection)?

From: Jeff King <hidden>
Date: 2018-02-02 06:51:53

On Thu, Feb 01, 2018 at 06:13:52PM -0800, Timothee Cour wrote:
this PR from october 2017 was discussing a patch that'd introduce
`--color-moved-[no-]ignore-space-change`
https://public-inbox.org/git/20171025224620.27657-3-sbeller@google.com/

however not sure what happened since then as I can't find in `git help
diff` options even after `brew install --HEAD git`

it's a really useful feature as it's a common use case (ppl move
blocks and reformat in same PR)
I think you can still do "--color-moved -w" to ignore whitespace. It's
just that the defaults did not end up getting flipped.

-Peff

Re: how to ignore whitespace changes with --color-moved (git diff move detection)?

From: Stefan Beller <hidden>
Date: 2018-02-02 18:23:50

On Thu, Feb 1, 2018 at 6:13 PM, Timothee Cour [off-list ref] wrote:
this PR from october 2017 was discussing a patch that'd introduce
`--color-moved-[no-]ignore-space-change`
https://public-inbox.org/git/20171025224620.27657-3-sbeller@google.com/

however not sure what happened since then as I can't find in `git help
diff` options even after `brew install --HEAD git`
I proposed it, but it wasn't going anywhere, because we seemed to have
a little disagreement over how a reasonable UX looks like.

The previous patch[1] in the series you link to, proposed 6 new
command line flags (3 flags + their negatives), which was deemed
inappropriate for the user ("which combination of these flags do you
need to give to get a good result?"), but I cannot find a reference for
that, I just vaguely recall that discussion.

[1] https://public-inbox.org/git/20171025224620.27657-2-sbeller@google.com/

it's a really useful feature as it's a common use case (ppl move
blocks and reformat in same PR)
Thanks for the encouraging words. For now you can
use '--color-moved -w' as Jeff King suggests, but that may
not be exactly what you want, because this
* creates the diff ignoring whitespaces
* and then colors the moved lines (also ignoring white spaces)
but when you want to
* obtain a real diff (no trickery with whitespaces)
* and then have some coloring aid ignoring white spaces
you are out of luck for now. Maybe you have a good idea for
the UX design? (What do we need there? Maybe an option
equivalent of `--color-moved-[no]-ignore-all-space` is sufficient
for all practical purposes?)
If it's not merged in git repo yet is there an easy way to try out
this feature? (even if experimental)
Can you compile Git yourself instead of installing it from homebrew?
(See "Build Git from source on OS X" on
https://www.atlassian.com/git/tutorials/install-git for example)
In that case, you can just patch your local version of Git with the
patches that you found. Download them as raw, and "git am"
them before running make.

Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help