Skip to content

Commit 874444b

Browse files
rhansengitster
authored andcommitted
diff: document the format of the -O (diff.orderFile) file
Signed-off-by: Richard Hansen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a5fccc commit 874444b

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

Documentation/diff-config.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,10 @@ diff.noprefix::
9999
If set, 'git diff' does not show any source or destination prefix.
100100

101101
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.
104104
If `diff.orderFile` is a relative pathname, it is treated as
105105
relative to the top of the working tree.
106-
Can be overridden by the '-O' option to linkgit:git-diff[1].
107106

108107
diff.renameLimit::
109108
The number of files to consider when performing the copy/rename

Documentation/diff-options.txt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,41 @@ information.
466466
endif::git-format-patch[]
467467

468468
-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.
471470
This overrides the `diff.orderFile` configuration variable
472471
(see linkgit:git-config[1]). To cancel `diff.orderFile`,
473472
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`".
474504

475505
ifndef::git-format-patch[]
476506
-R::

0 commit comments

Comments
 (0)