diff: document the new --color-moved setting

Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Jun 30, 2017 at 13:53 UTC 61e89eaae8824926dc03c47e6ab3aa990b5b832e
2 files changed +49 -2
Documentation/config.txt
+13 -2
@@ -1077,14 +1077,25 @@ This does not affect linkgit:git-format-patch[1] or the
1077 'git-diff-{asterisk}' plumbing commands. Can be overridden on the
1078 command line with the `--color[=<when>]` option.
1079
1080 +diff.colorMoved::
1081 + If set to either a valid `<mode>` or a true value, moved lines
1082 + in a diff are colored differently, for details of valid modes
1083 + see '--color-moved' in linkgit:git-diff[1]. If simply set to
1084 + true the default color mode will be used. When set to false,
1085 + moved lines are not colored.
1086 +
1087 color.diff.<slot>::
1088 Use customized color for diff colorization. `<slot>` specifies
1089 which part of the patch to use the specified color, and is one
1090 of `context` (context text - `plain` is a historical synonym),
1091 `meta` (metainformation), `frag`
1092 (hunk header), 'func' (function in hunk header), `old` (removed lines),
1086 - `new` (added lines), `commit` (commit headers), or `whitespace`
1087 - (highlighting whitespace errors).
1093 + `new` (added lines), `commit` (commit headers), `whitespace`
1094 + (highlighting whitespace errors), `oldMoved` (deleted lines),
1095 + `newMoved` (added lines), `oldMovedDimmed`, `oldMovedAlternative`,
1096 + `oldMovedAlternativeDimmed`, `newMovedDimmed`, `newMovedAlternative`
1097 + and `newMovedAlternativeDimmed` (See the '<mode>'
1098 + setting of '--color-moved' in linkgit:git-diff[1] for details).
1099
1100 color.decorate.<slot>::
1101 Use customized color for 'git log --decorate' output. `<slot>` is one
Documentation/diff-options.txt
+36
@@ -231,6 +231,42 @@ ifdef::git-diff[]
231 endif::git-diff[]
232 It is the same as `--color=never`.
233
234 +--color-moved[=<mode>]::
235 + Moved lines of code are colored differently.
236 +ifdef::git-diff[]
237 + It can be changed by the `diff.colorMoved` configuration setting.
238 +endif::git-diff[]
239 + The <mode> defaults to 'no' if the option is not given
240 + and to 'zebra' if the option with no mode is given.
241 + The mode must be one of:
242 ++
243 +--
244 +no::
245 + Moved lines are not highlighted.
246 +default::
247 + Is a synonym for `zebra`. This may change to a more sensible mode
248 + in the future.
249 +plain::
250 + Any line that is added in one location and was removed
251 + in another location will be colored with 'color.diff.newMoved'.
252 + Similarly 'color.diff.oldMoved' will be used for removed lines
253 + that are added somewhere else in the diff. This mode picks up any
254 + moved line, but it is not very useful in a review to determine
255 + if a block of code was moved without permutation.
256 +zebra::
257 + Blocks of moved code are detected greedily. The detected blocks are
258 + painted using either the 'color.diff.{old,new}Moved' color or
259 + 'color.diff.{old,new}MovedAlternative'. The change between
260 + the two colors indicates that a new block was detected. If there
261 + are fewer than 3 adjacent moved lines, they are not marked up
262 + as moved, but the regular colors 'color.diff.{old,new}' will be
263 + used.
264 +dimmed_zebra::
265 + Similar to 'zebra', but additional dimming of uninteresting parts
266 + of moved code is performed. The bordering lines of two adjacent
267 + blocks are considered interesting, the rest is uninteresting.
268 +--
269 +
270 --word-diff[=<mode>]::
271 Show a word diff, using the <mode> to delimit changed words.
272 By default, words are delimited by whitespace; see