Skip to content

Commit 831bd5e

Browse files
committed
Merge branch 'rh/diff-orderfile-doc'
Documentation fix. * rh/diff-orderfile-doc: diff: document the format of the -O (diff.orderFile) file diff: document behavior of relative diff.orderFile
2 parents e11c826 + 874444b commit 831bd5e

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

Documentation/diff-config.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ diff.noprefix::
105105
If set, 'git diff' does not show any source or destination prefix.
106106

107107
diff.orderFile::
108-
File indicating how to order files within a diff, using
109-
one shell glob pattern per line.
110-
Can be overridden by the '-O' option to linkgit:git-diff[1].
108+
File indicating how to order files within a diff.
109+
See the '-O' option to linkgit:git-diff[1] for details.
110+
If `diff.orderFile` is a relative pathname, it is treated as
111+
relative to the top of the working tree.
111112

112113
diff.renameLimit::
113114
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)