git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Using --word-diff breaks --color-moved
@ 2018-10-31  2:05 james harvey
  2018-10-31  4:27 ` Junio C Hamano
  2018-10-31 17:41 ` Stefan Beller
  0 siblings, 2 replies; 7+ messages in thread
From: james harvey @ 2018-10-31  2:05 UTC (permalink / raw)
  To: git; +Cc: sbeller

If you use both "--word-diff" and "--color-moved", regardless of the
order of arguments, "--word-diff" takes precedence and "--color-moved"
isn't allowed to do anything.

I think "--color-moved" should have precedence over "--word-diff".  I
cannot think of a scenario where a user would supply both options, and
actually want "--word-diff" to take precedence.  If I'm not thinking
of a scenario where this wouldn't be desired, perhaps whichever is
first as an argument could take precedence.

(The same behavior happens if 4+ lines are moved and
"--color-moved{default=zebra}" is used, but below
"--color-moved=plain" is used to be a smaller testcase.)

Given the following setup:

$ cat << EOF > file
> a
> b
> c
> EOF
$ git add file
$ git commit -m "Added file."
$ cat << EOF > file
> b
> c
> a
> EOF

You can have moved lines colorization:
$ git diff --color-moved=plain
...
[oldMovedColor]-a
b
c
[newMovedColor]+a

You can diff based on words:
$ git diff --word-diff
...
[oldColor][-a-]
b
c
[newColor][+a+}

But, you cannot diff based on words, and have moved lines colorization:
$ git diff --color-moved=plain --word-diff
$ git diff --word-diff
...
[oldColor][-a-]
b
c
[newColor][+a+}

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-02 20:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31  2:05 Using --word-diff breaks --color-moved james harvey
2018-10-31  4:27 ` Junio C Hamano
2018-10-31  7:07   ` james harvey
2018-10-31 17:43     ` Stefan Beller
2018-10-31 17:41 ` Stefan Beller
2018-11-02  1:18   ` james harvey
2018-11-02 20:46     ` Stefan Beller

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).