git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Richard Hansen <hansenr@google.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com
Subject: [PATCH v2 2/2] diff: document the format of the -O (diff.orderFile) file
Date: Tue, 10 Jan 2017 20:57:20 -0500	[thread overview]
Message-ID: <20170111015720.111223-3-hansenr@google.com> (raw)
In-Reply-To: <20170111015720.111223-1-hansenr@google.com>

Signed-off-by: Richard Hansen <hansenr@google.com>
---
 Documentation/diff-config.txt  |  5 ++--
 Documentation/diff-options.txt | 54 ++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
index 875212045..9e4111320 100644
--- a/Documentation/diff-config.txt
+++ b/Documentation/diff-config.txt
@@ -99,11 +99,10 @@ diff.noprefix::
 	If set, 'git diff' does not show any source or destination prefix.
 
 diff.orderFile::
-	File indicating how to order files within a diff, using
-	one shell glob pattern per line.
+	File indicating how to order files within a diff.
+	See the '-O' option to linkgit:git-diff[1] for details.
 	If `diff.orderFile` is a relative pathname, it is treated as
 	relative to the top of the work tree.
-	Can be overridden by the '-O' option to linkgit:git-diff[1].
 
 diff.renameLimit::
 	The number of files to consider when performing the copy/rename
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index e6215c372..e57e9f810 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -466,11 +466,61 @@ information.
 endif::git-format-patch[]
 
 -O<orderfile>::
-	Output the patch in the order specified in the
-	<orderfile>, which has one shell glob pattern per line.
+	Control the order in which files appear in the output.
 	This overrides the `diff.orderFile` configuration variable
 	(see linkgit:git-config[1]).  To cancel `diff.orderFile`,
 	use `-O/dev/null`.
++
+The output order is determined by the order of glob patterns in
+<orderfile>.
+All files with pathnames that match the first pattern are output
+first, all files with pathnames that match the second pattern (but not
+the first) are output next, and so on.
+All files with pathnames that do not match any pattern are output
+last, as if there was an implicit match-all pattern at the end of the
+file.
+If multiple pathnames have the same rank, their output order relative
+to each other is the normal order.
++
+<orderfile> is parsed as follows:
++
+--
+ - Blank lines are ignored, so they can be used as separators for
+   readability.
+
+ - Lines starting with a hash ("`#`") are ignored, so they can be used
+   for comments.  Add a backslash ("`\`") to the beginning of the
+   pattern if it starts with a hash.
+
+ - Each other line contains a single pattern.
+--
++
+Patterns have the same syntax and semantics as patterns used for
+fnmantch(3) with the FNM_PATHNAME flag, except multiple consecutive
+unescaped asterisks (e.g., "`**`") have a special meaning:
++
+--
+ - A pattern beginning with "`**/`" means match in all directories.
+   For example, "`**/foo`" matches filename "`foo`" anywhere, and
+   "`**/foo/bar`" matches filename "`bar`" anywhere that is directly
+   under directory "`foo`".
+
+ - A pattern ending with "`/**`" matches everything inside a
+   directory, with infinite depth.  For example, "`abc/**`" matches
+   "`abc/def/ghi`" but not "`foo/abc/def`".
+
+ - A slash followed by two consecutive asterisks then a slash
+   ("`/**/`") matches zero or more directory components.  For example,
+   "`a/**/b`" matches "`a/b`", "`a/x/b`", "`a/x/y/b`" and so on.
+
+ - A pattern with more than one consecutive unescaped asterisk is
+   invalid.
+--
++
+In addition, a pathname matches a pattern if the pathname with any
+number of its final pathname components removed matches the pattern.
+For example, the pattern "`foo/*bar`" matches "`foo/asdfbar`" and
+"`foo/bar/baz`" but not "`foo/barx`".
 
 ifndef::git-format-patch[]
 -R::
-- 
2.11.0.390.gc69c2f50cf-goog


  parent reply	other threads:[~2017-01-11  1:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10  0:40 [PATCH 0/2] minor diff orderfile documentation improvements Richard Hansen
2017-01-10  0:40 ` [PATCH 1/2] diff: document behavior of relative diff.orderFile Richard Hansen
2017-01-10  6:58   ` Jeff King
2017-01-10 17:27     ` Richard Hansen
2017-01-10 20:19       ` Junio C Hamano
2017-01-10 20:23         ` Junio C Hamano
2017-01-10 22:01           ` Richard Hansen
2017-01-10 22:15             ` Junio C Hamano
2017-01-11 14:41               ` Jeff King
2017-01-11 20:53                 ` Junio C Hamano
2017-01-10  0:40 ` [PATCH 2/2] diff: document the pattern format for diff.orderFile Richard Hansen
2017-01-10 20:14   ` Junio C Hamano
2017-01-11  1:14     ` Richard Hansen
2017-01-11  2:46       ` Junio C Hamano
2017-01-11 17:24         ` Richard Hansen
2017-01-11 18:15           ` Junio C Hamano
2017-01-11 18:36             ` Richard Hansen
2017-01-11 21:06               ` Junio C Hamano
2017-01-11  1:57 ` [PATCH v2 0/2] diff orderfile documentation improvements Richard Hansen
2017-01-11  1:57   ` [PATCH v2 1/2] diff: document behavior of relative diff.orderFile Richard Hansen
2017-01-11  1:57   ` Richard Hansen [this message]
2017-01-15 22:16   ` [PATCH v3 0/2] diff orderfile documentation improvements Richard Hansen
2017-01-15 22:16     ` [PATCH v3 1/2] diff: document behavior of relative diff.orderFile Richard Hansen
2017-01-15 22:16     ` [PATCH v3 2/2] diff: document the format of the -O (diff.orderFile) file Richard Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170111015720.111223-3-hansenr@google.com \
    --to=hansenr@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).