author | Thomas Rast <trast@student.ethz.ch> | |
Wed, 14 Apr 2010 15:59:06 +0000 (17:59 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 14 Apr 2010 17:56:53 +0000 (10:56 -0700) | ||
commit | 882749a04f828fccd795deec4d0bf10ba09ae549 | |
tree | 3a0f2416464fd69565c29e701ad02cad83f4f89d | tree | snapshot |
parent | 6555b196f00128f13ab8f719ee1e156238f16bb3 | commit | diff |
diff: add --word-diff option that generalizes --color-words
This teaches the --color-words engine a more general interface that
supports two new modes:
* --word-diff=plain, inspired by the 'wdiff' utility (most similar to
'wdiff -n <old> <new>'): uses delimiters [-removed-] and {+added+}
* --word-diff=porcelain, which generates an ad-hoc machine readable
format:
- each diff unit is prefixed by [-+ ] and terminated by newline as
in unified diff
- newlines in the input are output as a line consisting only of a
tilde '~'
Both of these formats still support color if it is enabled, using it
to highlight the differences. --color-words becomes a synonym for
--word-diff=color, which is the color-only format. Also adds some
compatibility/convenience options.
Thanks to Junio C Hamano and Miles Bader for good ideas.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This teaches the --color-words engine a more general interface that
supports two new modes:
* --word-diff=plain, inspired by the 'wdiff' utility (most similar to
'wdiff -n <old> <new>'): uses delimiters [-removed-] and {+added+}
* --word-diff=porcelain, which generates an ad-hoc machine readable
format:
- each diff unit is prefixed by [-+ ] and terminated by newline as
in unified diff
- newlines in the input are output as a line consisting only of a
tilde '~'
Both of these formats still support color if it is enabled, using it
to highlight the differences. --color-words becomes a synonym for
--word-diff=color, which is the color-only format. Also adds some
compatibility/convenience options.
Thanks to Junio C Hamano and Miles Bader for good ideas.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/diff-options.txt | diff | blob | history | |
Documentation/gitattributes.txt | diff | blob | history | |
color.c | diff | blob | history | |
color.h | diff | blob | history | |
diff.c | diff | blob | history | |
diff.h | diff | blob | history | |
t/t4034-diff-words.sh | diff | blob | history |