aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-05-21 04:02:17 -0700
committerJunio C Hamano <gitster@pobox.com>2010-05-21 04:02:17 -0700
commit1bdd46cd3a2fe1e0aeb965fb0edb493064e24495 (patch)
tree9fa257f211ffb509cb07dac585f5a80b433d795c /Documentation
parente22d62d9151e0e51c3dc4f951fb5d88dc30482c6 (diff)
parent882749a04f828fccd795deec4d0bf10ba09ae549 (diff)
downloadgit-1bdd46cd3a2fe1e0aeb965fb0edb493064e24495.tar.gz
git-1bdd46cd3a2fe1e0aeb965fb0edb493064e24495.tar.xz
Merge branch 'tr/word-diff'
* tr/word-diff: diff: add --word-diff option that generalizes --color-words Conflicts: diff.c
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/diff-options.txt40
-rw-r--r--Documentation/gitattributes.txt2
2 files changed, 37 insertions, 5 deletions
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 4a968591c..0d89aaaf2 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -127,11 +127,39 @@ any of those replacements occurred.
gives the default to color output.
Same as `--color=never`.
---color-words[=<regex>]::
- Show colored word diff, i.e., color words which have changed.
- By default, words are separated by whitespace.
+--word-diff[=<mode>]::
+ Show a word diff, using the <mode> to delimit changed words.
+ By default, words are delimited by whitespace; see
+ `--word-diff-regex` below. The <mode> defaults to 'plain', and
+ must be one of:
++
+--
+color::
+ Highlight changed words using only colors. Implies `--color`.
+plain::
+ Show words as `[-removed-]` and `{+added+}`. Makes no
+ attempts to escape the delimiters if they appear in the input,
+ so the output may be ambiguous.
+porcelain::
+ Use a special line-based format intended for script
+ consumption. Added/removed/unchanged runs are printed in the
+ usual unified diff format, starting with a `+`/`-`/` `
+ character at the beginning of the line and extending to the
+ end of the line. Newlines in the input are represented by a
+ tilde `~` on a line of its own.
+none::
+ Disable word diff again.
+--
++
+Note that despite the name of the first mode, color is used to
+highlight the changed parts in all modes if enabled.
+
+--word-diff-regex=<regex>::
+ Use <regex> to decide what a word is, instead of considering
+ runs of non-whitespace to be a word. Also implies
+ `--word-diff` unless it was already enabled.
+
-When a <regex> is specified, every non-overlapping match of the
+Every non-overlapping match of the
<regex> is considered a word. Anything between these matches is
considered whitespace and ignored(!) for the purposes of finding
differences. You may want to append `|[^[:space:]]` to your regular
@@ -143,6 +171,10 @@ The regex can also be set via a diff driver or configuration option, see
linkgit:gitattributes[1] or linkgit:git-config[1]. Giving it explicitly
overrides any diff driver or configuration setting. Diff drivers
override configuration settings.
+
+--color-words[=<regex>]::
+ Equivalent to `--word-diff=color` plus (if a regex was
+ specified) `--word-diff-regex=<regex>`.
endif::git-format-patch[]
--no-renames::
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index a8500d177..0523a5769 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -360,7 +360,7 @@ patterns are available:
Customizing word diff
^^^^^^^^^^^^^^^^^^^^^
-You can customize the rules that `git diff --color-words` uses to
+You can customize the rules that `git diff --word-diff` uses to
split words in a line, by specifying an appropriate regular expression
in the "diff.*.wordRegex" configuration variable. For example, in TeX
a backslash followed by a sequence of letters forms a command, but