diff: document the format of the -O (diff.orderFile) file
Signed-off-by: Richard Hansen <hansenr@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Richard Hansen committed
Jan 15, 2017 at 17:16 UTC
874444b70451879d5b9b7e288e5c4e711c4a87ac
2 files changed
+34
-5
Documentation/diff-config.txt
+2
-3
@@ -99,11 +99,10 @@ diff.noprefix::
99
If set, 'git diff' does not show any source or destination prefix.
100
101
diff.orderFile::
102
- File indicating how to order files within a diff, using
103
- one shell glob pattern per line.
102
+ File indicating how to order files within a diff.
103
+ See the '-O' option to linkgit:git-diff[1] for details.
104
If `diff.orderFile` is a relative pathname, it is treated as
105
relative to the top of the working tree.
106
- Can be overridden by the '-O' option to linkgit:git-diff[1].
106
107
diff.renameLimit::
108
The number of files to consider when performing the copy/rename
Documentation/diff-options.txt
+32
-2
@@ -466,11 +466,41 @@ information.
466
endif::git-format-patch[]
467
468
-O<orderfile>::
469
- Output the patch in the order specified in the
470
- <orderfile>, which has one shell glob pattern per line.
469
+ Control the order in which files appear in the output.
470
This overrides the `diff.orderFile` configuration variable
471
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
472
use `-O/dev/null`.
473
++
474
+The output order is determined by the order of glob patterns in
475
+<orderfile>.
476
+All files with pathnames that match the first pattern are output
477
+first, all files with pathnames that match the second pattern (but not
478
+the first) are output next, and so on.
479
+All files with pathnames that do not match any pattern are output
480
+last, as if there was an implicit match-all pattern at the end of the
481
+file.
482
+If multiple pathnames have the same rank (they match the same pattern
483
+but no earlier patterns), their output order relative to each other is
484
+the normal order.
485
++
486
+<orderfile> is parsed as follows:
487
++
488
+--
489
+ - Blank lines are ignored, so they can be used as separators for
490
+ readability.
491
+
492
+ - Lines starting with a hash ("`#`") are ignored, so they can be used
493
+ for comments. Add a backslash ("`\`") to the beginning of the
494
+ pattern if it starts with a hash.
495
+
496
+ - Each other line contains a single pattern.
497
+--
498
++
499
+Patterns have the same syntax and semantics as patterns used for
500
+fnmantch(3) without the FNM_PATHNAME flag, except a pathname also
501
+matches a pattern if removing any number of the final pathname
502
+components matches the pattern. For example, the pattern "`foo*bar`"
503
+matches "`fooasdfbar`" and "`foo/bar/baz/asdf`" but not "`foobarx`".
504
505
ifndef::git-format-patch[]
506
-R::