From: Junio C Hamano Date: Tue, 9 Jan 2018 22:32:57 +0000 (-0800) Subject: Merge branch 'jk/doc-diff-options' X-Git-Tag: v2.16.0-rc2~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6366dd9000a3f67e47a30d94375a88dabc18ec6f?ds=inline;hp=-c Merge branch 'jk/doc-diff-options' Doc update. * jk/doc-diff-options: docs/diff-options: clarify scope of diff-filter types --- 6366dd9000a3f67e47a30d94375a88dabc18ec6f diff --combined Documentation/diff-options.txt index 9d1586b956,eec583d4ee..743af97b06 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@@ -63,12 -63,7 +63,12 @@@ ifndef::git-format-patch[ Synonym for `-p --raw`. endif::git-format-patch[] -include::diff-heuristic-options.txt[] +--indent-heuristic:: + Enable the heuristic that shift diff hunk boundaries to make patches + easier to read. This is the default. + +--no-indent-heuristic:: + Disable the indent heuristic. --minimal:: Spend extra time to make sure the smallest possible @@@ -80,16 -75,6 +80,16 @@@ --histogram:: Generate a diff using the "histogram diff" algorithm. +--anchored=:: + Generate a diff using the "anchored diff" algorithm. ++ +This option may be specified more than once. ++ +If a line exists in both the source and destination, exists only once, +and starts with this text, this algorithm attempts to prevent it from +appearing as a deletion or addition in the output. It uses the "patience +diff" algorithm internally. + --diff-algorithm={patience|minimal|histogram|myers}:: Choose a diff algorithm. The variants are as follows: + @@@ -207,9 -192,10 +207,9 @@@ ifndef::git-log[ given, do not munge pathnames and use NULs as output field terminators. endif::git-log[] + -Without this option, each pathname output will have TAB, LF, double quotes, -and backslash characters replaced with `\t`, `\n`, `\"`, and `\\`, -respectively, and the pathname will be enclosed in double quotes if -any of those replacements occurred. +Without this option, pathnames with "unusual" characters are quoted as +explained for the configuration variable `core.quotePath` (see +linkgit:git-config[1]). --name-only:: Show only names of changed files. @@@ -246,40 -232,6 +246,40 @@@ ifdef::git-diff[ endif::git-diff[] It is the same as `--color=never`. +--color-moved[=]:: + Moved lines of code are colored differently. +ifdef::git-diff[] + It can be changed by the `diff.colorMoved` configuration setting. +endif::git-diff[] + The defaults to 'no' if the option is not given + and to 'zebra' if the option with no mode is given. + The mode must be one of: ++ +-- +no:: + Moved lines are not highlighted. +default:: + Is a synonym for `zebra`. This may change to a more sensible mode + in the future. +plain:: + Any line that is added in one location and was removed + in another location will be colored with 'color.diff.newMoved'. + Similarly 'color.diff.oldMoved' will be used for removed lines + that are added somewhere else in the diff. This mode picks up any + moved line, but it is not very useful in a review to determine + if a block of code was moved without permutation. +zebra:: + Blocks of moved text of at least 20 alphanumeric characters + are detected greedily. The detected blocks are + painted using either the 'color.diff.{old,new}Moved' color or + 'color.diff.{old,new}MovedAlternative'. The change between + the two colors indicates that a new block was detected. +dimmed_zebra:: + Similar to 'zebra', but additional dimming of uninteresting parts + of moved code is performed. The bordering lines of two adjacent + blocks are considered interesting, the rest is uninteresting. +-- + --word-diff[=]:: Show a word diff, using the to delimit changed words. By default, words are delimited by whitespace; see @@@ -349,14 -301,15 +349,14 @@@ ifndef::git-format-patch[ with --exit-code. --ws-error-highlight=:: - Highlight whitespace errors on lines specified by - in the color specified by `color.diff.whitespace`. - is a comma separated list of `old`, `new`, `context`. When - this option is not given, only whitespace errors in `new` - lines are highlighted. E.g. `--ws-error-highlight=new,old` - highlights whitespace errors on both deleted and added lines. - `all` can be used as a short-hand for `old,new,context`. - The `diff.wsErrorHighlight` configuration variable can be - used to specify the default behaviour. + Highlight whitespace errors in the `context`, `old` or `new` + lines of the diff. Multiple values are separated by comma, + `none` resets previous values, `default` reset the list to + `new` and `all` is a shorthand for `old,new,context`. When + this option is not given, and the configuration variable + `diff.wsErrorHighlight` is not set, only whitespace errors in + `new` lines are highlighted. The whitespace errors are colored + whith `color.diff.whitespace`. endif::git-format-patch[] @@@ -440,7 -393,7 +440,7 @@@ endif::git-log[ the diff between the preimage and `/dev/null`. The resulting patch is not meant to be applied with `patch` or `git apply`; this is solely for people who want to just concentrate on reviewing the - text after the change. In addition, the output obviously lack + text after the change. In addition, the output obviously lacks enough information to apply such a patch in reverse, even manually, hence the name of the option. + @@@ -469,6 -422,12 +469,12 @@@ ifndef::git-format-patch[ + Also, these upper-case letters can be downcased to exclude. E.g. `--diff-filter=ad` excludes added and deleted paths. + + + Note that not all diffs can feature all types. For instance, diffs + from the index to the working tree can never have Added entries + (because the set of paths included in the diff is limited by what is in + the index). Similarly, copied and renamed entries cannot appear if + detection for those types is disabled. -S:: Look for differences that change the number of occurrences of @@@ -567,9 -526,6 +573,9 @@@ endif::git-format-patch[ --text:: Treat all files as text. +--ignore-cr-at-eol:: + Ignore carrige-return at the end of line when doing a comparison. + --ignore-space-at-eol:: Ignore changes in whitespace at EOL.