{"thread":{"id":"44843","subject":"[PATCH 0/2] minor diff orderfile documentation improvements","startedAt":"2017-01-10T00:41:02Z","lastAt":"2017-01-15T22:17:16Z","messageCount":24,"participants":["Richard Hansen","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"309097","messageId":"20170110004031.57985-1-hansenr@google.com","threadId":"44843","inReplyTo":null,"subject":"[PATCH 0/2] minor diff orderfile documentation improvements","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T00:40:29Z","receivedAt":"2017-01-10T00:41:02Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Richard Hansen (2):\n  diff: document behavior of relative diff.orderFile\n  diff: document the pattern format for diff.orderFile\n\n Documentation/diff-config.txt  | 5 ++++-\n Documentation/diff-options.txt | 3 ++-\n 2 files changed, 6 insertions(+), 2 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309098","messageId":"20170110004031.57985-2-hansenr@google.com","threadId":"44843","inReplyTo":"20170110004031.57985-1-hansenr@google.com","subject":"[PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T00:40:30Z","receivedAt":"2017-01-10T00:41:07Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Document that a relative pathname for diff.orderFile is interpreted as\nrelative to the top-level work directory.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/diff-config.txt | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 58f4bd6af..875212045 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -101,6 +101,8 @@ diff.noprefix::\n diff.orderFile::\n \tFile indicating how to order files within a diff, using\n \tone shell glob pattern per line.\n+\tIf `diff.orderFile` is a relative pathname, it is treated as\n+\trelative to the top of the work tree.\n \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n \n diff.renameLimit::\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309099","messageId":"20170110004031.57985-3-hansenr@google.com","threadId":"44843","inReplyTo":"20170110004031.57985-1-hansenr@google.com","subject":"[PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T00:40:31Z","receivedAt":"2017-01-10T00:41:13Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Document the format of the patterns used for the diff.orderFile\nsetting and diff's '-O' option by referring the reader to the\ngitignore[5] page.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/diff-config.txt  | 3 ++-\n Documentation/diff-options.txt | 3 ++-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 875212045..a35ecdd6b 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -100,7 +100,8 @@ diff.noprefix::\n \n diff.orderFile::\n \tFile indicating how to order files within a diff, using\n-\tone shell glob pattern per line.\n+\tone glob pattern per line.\n+\tSee linkgit:gitignore[5] for the pattern format.\n \tIf `diff.orderFile` is a relative pathname, it is treated as\n \trelative to the top of the work tree.\n \tCan be overridden by the '-O' option to linkgit:git-diff[1].\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex e6215c372..dc6b1af71 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -467,7 +467,8 @@ endif::git-format-patch[]\n \n -O<orderfile>::\n \tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n+\t<orderfile>, which has one glob pattern per line.\n+\tSee linkgit:gitignore[5] for the pattern format.\n \tThis overrides the `diff.orderFile` configuration variable\n \t(see linkgit:git-config[1]).  To cancel `diff.orderFile`,\n \tuse `-O/dev/null`.\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309108","messageId":"20170110065816.pu325sxajbyuqpj6@sigill.intra.peff.net","threadId":"44843","inReplyTo":"20170110004031.57985-2-hansenr@google.com","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-10T06:58:16Z","receivedAt":"2017-01-10T06:58:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jan 09, 2017 at 07:40:30PM -0500, Richard Hansen wrote:\n\n> Document that a relative pathname for diff.orderFile is interpreted as\n> relative to the top-level work directory.\n> \n> Signed-off-by: Richard Hansen <hansenr@google.com>\n> ---\n>  Documentation/diff-config.txt | 2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\n> index 58f4bd6af..875212045 100644\n> --- a/Documentation/diff-config.txt\n> +++ b/Documentation/diff-config.txt\n> @@ -101,6 +101,8 @@ diff.noprefix::\n>  diff.orderFile::\n>  \tFile indicating how to order files within a diff, using\n>  \tone shell glob pattern per line.\n> +\tIf `diff.orderFile` is a relative pathname, it is treated as\n> +\trelative to the top of the work tree.\n>  \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n\nWhat happens in a bare repository?\n\nI'm guessing it's relative to the top-level of the repository, but we\nshould probably spell it out.\n\nThe other case is --no-index when we are not in a repository at all, but\nthat should just be relative to the current directory, which isn't\nreally worth mentioning.\n\n-Peff\n"},{"id":"309147","messageId":"e100d30a-5ee8-8485-5012-f9b1c6961ffa@google.com","threadId":"44843","inReplyTo":"20170110065816.pu325sxajbyuqpj6@sigill.intra.peff.net","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T17:27:41Z","receivedAt":"2017-01-10T17:27:51Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-10 01:58, Jeff King wrote:\n> On Mon, Jan 09, 2017 at 07:40:30PM -0500, Richard Hansen wrote:\n>\n>> Document that a relative pathname for diff.orderFile is interpreted as\n>> relative to the top-level work directory.\n>>\n>> Signed-off-by: Richard Hansen <hansenr@google.com>\n>> ---\n>>  Documentation/diff-config.txt | 2 ++\n>>  1 file changed, 2 insertions(+)\n>>\n>> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\n>> index 58f4bd6af..875212045 100644\n>> --- a/Documentation/diff-config.txt\n>> +++ b/Documentation/diff-config.txt\n>> @@ -101,6 +101,8 @@ diff.noprefix::\n>>  diff.orderFile::\n>>  \tFile indicating how to order files within a diff, using\n>>  \tone shell glob pattern per line.\n>> +\tIf `diff.orderFile` is a relative pathname, it is treated as\n>> +\trelative to the top of the work tree.\n>>  \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n>\n> What happens in a bare repository?\n\nI didn't know which is why this patch is silent on that topic.  :)\n\n>\n> I'm guessing it's relative to the top-level of the repository,\n\nI just tried it out and it's relative to $PWD.\n\n> but we should probably spell it out.\n\nDo we want it to be relative to $PWD?  I think relative to $GIT_DIR is \nmore useful.  If we want it to be relative to $GIT_DIR, then I think we \nshould stay silent regarding bare repositories so that the behavior \nremains unspecified until we update the logic.\n\n>\n> The other case is --no-index when we are not in a repository at all, but\n> that should just be relative to the current directory,\n\nIt is.\n\n> which isn't really worth mentioning.\n\nAgreed.\n\nI'll post a re-roll if people prefer the current behavior over relative \nto $GIT_DIR.\n\nThanks for reviewing,\nRichard\n\n>\n> -Peff\n\n"},{"id":"309156","messageId":"xmqq8tqismdx.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"20170110004031.57985-3-hansenr@google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-10T20:14:34Z","receivedAt":"2017-01-10T20:14:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n> Document the format of the patterns used for the diff.orderFile\n> setting and diff's '-O' option by referring the reader to the\n> gitignore[5] page.\n>\n> Signed-off-by: Richard Hansen <hansenr@google.com>\n> ---\n>  Documentation/diff-config.txt  | 3 ++-\n>  Documentation/diff-options.txt | 3 ++-\n>  2 files changed, 4 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\n> index 875212045..a35ecdd6b 100644\n> --- a/Documentation/diff-config.txt\n> +++ b/Documentation/diff-config.txt\n> @@ -100,7 +100,8 @@ diff.noprefix::\n>  \n>  diff.orderFile::\n>  \tFile indicating how to order files within a diff, using\n> -\tone shell glob pattern per line.\n> +\tone glob pattern per line.\n> +\tSee linkgit:gitignore[5] for the pattern format.\n\n\nI do not think it is wise to suggest referring to gitignore, as the\nlogic of matching is quite different, other than the fact that they\nboth use wildmatch() internally.  Also, unlike gitignore, orderfile\ndoes not allow any negative matching i.e. \"!<pattern>\".\n\n>  \tIf `diff.orderFile` is a relative pathname, it is treated as\n>  \trelative to the top of the work tree.\n>  \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\n> index e6215c372..dc6b1af71 100644\n> --- a/Documentation/diff-options.txt\n> +++ b/Documentation/diff-options.txt\n> @@ -467,7 +467,8 @@ endif::git-format-patch[]\n>  \n>  -O<orderfile>::\n>  \tOutput the patch in the order specified in the\n> -\t<orderfile>, which has one shell glob pattern per line.\n> +\t<orderfile>, which has one glob pattern per line.\n> +\tSee linkgit:gitignore[5] for the pattern format.\n>  \tThis overrides the `diff.orderFile` configuration variable\n>  \t(see linkgit:git-config[1]).  To cancel `diff.orderFile`,\n>  \tuse `-O/dev/null`.\n"},{"id":"309157","messageId":"xmqq4m16sm5v.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"e100d30a-5ee8-8485-5012-f9b1c6961ffa@google.com","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-10T20:19:24Z","receivedAt":"2017-01-10T20:19:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n> On 2017-01-10 01:58, Jeff King wrote:\n> ...\n>> What happens in a bare repository?\n>>\n>> I'm guessing it's relative to the top-level of the repository,\n>\n> I just tried it out and it's relative to $PWD.\n\nThat is understandable.  When the user says\n\n    $ cmd -O $file\n\nwith any option -O that takes a filename, it is most natural if we\nused $PWD/$file when $file is not absolute path.\n\n"},{"id":"309158","messageId":"xmqqziiyr7e9.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"xmqq4m16sm5v.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-10T20:23:42Z","receivedAt":"2017-01-10T20:23:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Richard Hansen <hansenr@google.com> writes:\n>\n>> On 2017-01-10 01:58, Jeff King wrote:\n>> ...\n>>> What happens in a bare repository?\n>>>\n>>> I'm guessing it's relative to the top-level of the repository,\n>>\n>> I just tried it out and it's relative to $PWD.\n>\n> That is understandable.  When the user says\n>\n>     $ cmd -O $file\n>\n> with any option -O that takes a filename, it is most natural if we\n> used $PWD/$file when $file is not absolute path.\n\nAhh, ignore me in the above.  The discussion is about the\nconfiguration variable, and I agree that being relative to GIT_DIR\nwould have made more sense.  In fact taking it as relative to PWD\ndoes not make any sense.\n\nWe should have been a lot more careful when we added 6d8940b562\n(\"diff: add diff.orderfile configuration variable\", 2013-12-18), but\nit is too late to complain now.\n\nA related tangent.  \n\nI wonder if anything that uses git_config_pathname() should be\nrelative to GIT_DIR when it is not absolute.\n\n"},{"id":"309183","messageId":"9daa70e4-82b0-a82a-67b9-e893546638a7@google.com","threadId":"44843","inReplyTo":"xmqqziiyr7e9.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-10T22:01:22Z","receivedAt":"2017-01-10T22:01:28Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-10 15:23, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> Richard Hansen <hansenr@google.com> writes:\n>>\n>>> On 2017-01-10 01:58, Jeff King wrote:\n>>> ...\n>>>> What happens in a bare repository?\n>>>>\n>>>> I'm guessing it's relative to the top-level of the repository,\n>>>\n>>> I just tried it out and it's relative to $PWD.\n>>\n>> That is understandable.  When the user says\n>>\n>>     $ cmd -O $file\n>>\n>> with any option -O that takes a filename, it is most natural if we\n>> used $PWD/$file when $file is not absolute path.\n>\n> Ahh, ignore me in the above.  The discussion is about the\n> configuration variable, and I agree that being relative to GIT_DIR\n> would have made more sense.  In fact taking it as relative to PWD\n> does not make any sense.\n\nI'll stay silent regarding bare repositories then.\n\n>\n> We should have been a lot more careful when we added 6d8940b562\n> (\"diff: add diff.orderfile configuration variable\", 2013-12-18), but\n> it is too late to complain now.\n>\n> A related tangent.\n>\n> I wonder if anything that uses git_config_pathname() should be\n> relative to GIT_DIR when it is not absolute.\n\nI think so.  (For bare repositories anyway; non-bare should be relative \nto GIT_WORK_TREE.)  Perhaps git_config_pathname() itself should convert \nrelative paths to absolute so that every pathname setting automatically \nworks without changing any calling code.\n\n-Richard\n"},{"id":"309186","messageId":"xmqqtw96pno0.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"9daa70e4-82b0-a82a-67b9-e893546638a7@google.com","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-10T22:15:11Z","receivedAt":"2017-01-10T22:15:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n>> A related tangent.\n>>\n>> I wonder if anything that uses git_config_pathname() should be\n>> relative to GIT_DIR when it is not absolute.\n>\n> I think so.  (For bare repositories anyway; non-bare should be\n> relative to GIT_WORK_TREE.)  Perhaps git_config_pathname() itself\n> should convert relative paths to absolute so that every pathname\n> setting automatically works without changing any calling code.\n\nYes, that was what I was alluding to.  We might have to wait until\nmajor version boundary to do so, but I think that it is the sensible\nway forward in the longer term to convert relative to absolute in\ngit_config_pathname().\n\nThanks.\n\n"},{"id":"309195","messageId":"17d48ccd-fd19-3922-8ee8-af6558d22632@google.com","threadId":"44843","inReplyTo":"xmqq8tqismdx.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-11T01:14:35Z","receivedAt":"2017-01-11T01:14:43Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-10 15:14, Junio C Hamano wrote:\n> Richard Hansen <hansenr@google.com> writes:\n>\n>> Document the format of the patterns used for the diff.orderFile\n>> setting and diff's '-O' option by referring the reader to the\n>> gitignore[5] page.\n>>\n>> Signed-off-by: Richard Hansen <hansenr@google.com>\n>> ---\n>>  Documentation/diff-config.txt  | 3 ++-\n>>  Documentation/diff-options.txt | 3 ++-\n>>  2 files changed, 4 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\n>> index 875212045..a35ecdd6b 100644\n>> --- a/Documentation/diff-config.txt\n>> +++ b/Documentation/diff-config.txt\n>> @@ -100,7 +100,8 @@ diff.noprefix::\n>>\n>>  diff.orderFile::\n>>  \tFile indicating how to order files within a diff, using\n>> -\tone shell glob pattern per line.\n>> +\tone glob pattern per line.\n>> +\tSee linkgit:gitignore[5] for the pattern format.\n>\n>\n> I do not think it is wise to suggest referring to gitignore, as the\n> logic of matching is quite different, other than the fact that they\n> both use wildmatch() internally.  Also, unlike gitignore, orderfile\n> does not allow any negative matching i.e. \"!<pattern>\".\n\nI was looking at the code to see how the two file formats differed and \nnoticed that match_order() doesn't set the WM_PATHNAME flag when it \ncalls wildmatch().  That's unintentional (a bug), right?\n\n-Richard\n\n\n>\n>>  \tIf `diff.orderFile` is a relative pathname, it is treated as\n>>  \trelative to the top of the work tree.\n>>  \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n>> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\n>> index e6215c372..dc6b1af71 100644\n>> --- a/Documentation/diff-options.txt\n>> +++ b/Documentation/diff-options.txt\n>> @@ -467,7 +467,8 @@ endif::git-format-patch[]\n>>\n>>  -O<orderfile>::\n>>  \tOutput the patch in the order specified in the\n>> -\t<orderfile>, which has one shell glob pattern per line.\n>> +\t<orderfile>, which has one glob pattern per line.\n>> +\tSee linkgit:gitignore[5] for the pattern format.\n>>  \tThis overrides the `diff.orderFile` configuration variable\n>>  \t(see linkgit:git-config[1]).  To cancel `diff.orderFile`,\n>>  \tuse `-O/dev/null`.\n\n"},{"id":"309196","messageId":"20170111015720.111223-1-hansenr@google.com","threadId":"44843","inReplyTo":"20170110004031.57985-1-hansenr@google.com","subject":"[PATCH v2 0/2] diff orderfile documentation improvements","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-11T01:57:18Z","receivedAt":"2017-01-11T01:57:54Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Changes from v1:\n  * Don't reference gitignore for the file format because they're not\n    quite the same.\n\nRichard Hansen (2):\n  diff: document behavior of relative diff.orderFile\n  diff: document the format of the -O (diff.orderFile) file\n\n Documentation/diff-config.txt  |  7 +++---\n Documentation/diff-options.txt | 54 ++++++++++++++++++++++++++++++++++++++++--\n 2 files changed, 56 insertions(+), 5 deletions(-)\n\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309197","messageId":"20170111015720.111223-2-hansenr@google.com","threadId":"44843","inReplyTo":"20170111015720.111223-1-hansenr@google.com","subject":"[PATCH v2 1/2] diff: document behavior of relative diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-11T01:57:19Z","receivedAt":"2017-01-11T01:57:59Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Document that a relative pathname for diff.orderFile is interpreted as\nrelative to the top-level work directory.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/diff-config.txt | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 58f4bd6af..875212045 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -101,6 +101,8 @@ diff.noprefix::\n diff.orderFile::\n \tFile indicating how to order files within a diff, using\n \tone shell glob pattern per line.\n+\tIf `diff.orderFile` is a relative pathname, it is treated as\n+\trelative to the top of the work tree.\n \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n \n diff.renameLimit::\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309198","messageId":"20170111015720.111223-3-hansenr@google.com","threadId":"44843","inReplyTo":"20170111015720.111223-1-hansenr@google.com","subject":"[PATCH v2 2/2] diff: document the format of the -O (diff.orderFile) file","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-11T01:57:20Z","receivedAt":"2017-01-11T01:58:02Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Signed-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/diff-config.txt  |  5 ++--\n Documentation/diff-options.txt | 54 ++++++++++++++++++++++++++++++++++++++++--\n 2 files changed, 54 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 875212045..9e4111320 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -99,11 +99,10 @@ diff.noprefix::\n \tIf set, 'git diff' does not show any source or destination prefix.\n \n diff.orderFile::\n-\tFile indicating how to order files within a diff, using\n-\tone shell glob pattern per line.\n+\tFile indicating how to order files within a diff.\n+\tSee the '-O' option to linkgit:git-diff[1] for details.\n \tIf `diff.orderFile` is a relative pathname, it is treated as\n \trelative to the top of the work tree.\n-\tCan be overridden by the '-O' option to linkgit:git-diff[1].\n \n diff.renameLimit::\n \tThe number of files to consider when performing the copy/rename\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex e6215c372..e57e9f810 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -466,11 +466,61 @@ information.\n endif::git-format-patch[]\n \n -O<orderfile>::\n-\tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n+\tControl the order in which files appear in the output.\n \tThis overrides the `diff.orderFile` configuration variable\n \t(see linkgit:git-config[1]).  To cancel `diff.orderFile`,\n \tuse `-O/dev/null`.\n++\n+The output order is determined by the order of glob patterns in\n+<orderfile>.\n+All files with pathnames that match the first pattern are output\n+first, all files with pathnames that match the second pattern (but not\n+the first) are output next, and so on.\n+All files with pathnames that do not match any pattern are output\n+last, as if there was an implicit match-all pattern at the end of the\n+file.\n+If multiple pathnames have the same rank, their output order relative\n+to each other is the normal order.\n++\n+<orderfile> is parsed as follows:\n++\n+--\n+ - Blank lines are ignored, so they can be used as separators for\n+   readability.\n+\n+ - Lines starting with a hash (\"`#`\") are ignored, so they can be used\n+   for comments.  Add a backslash (\"`\\`\") to the beginning of the\n+   pattern if it starts with a hash.\n+\n+ - Each other line contains a single pattern.\n+--\n++\n+Patterns have the same syntax and semantics as patterns used for\n+fnmantch(3) with the FNM_PATHNAME flag, except multiple consecutive\n+unescaped asterisks (e.g., \"`**`\") have a special meaning:\n++\n+--\n+ - A pattern beginning with \"`**/`\" means match in all directories.\n+   For example, \"`**/foo`\" matches filename \"`foo`\" anywhere, and\n+   \"`**/foo/bar`\" matches filename \"`bar`\" anywhere that is directly\n+   under directory \"`foo`\".\n+\n+ - A pattern ending with \"`/**`\" matches everything inside a\n+   directory, with infinite depth.  For example, \"`abc/**`\" matches\n+   \"`abc/def/ghi`\" but not \"`foo/abc/def`\".\n+\n+ - A slash followed by two consecutive asterisks then a slash\n+   (\"`/**/`\") matches zero or more directory components.  For example,\n+   \"`a/**/b`\" matches \"`a/b`\", \"`a/x/b`\", \"`a/x/y/b`\" and so on.\n+\n+ - A pattern with more than one consecutive unescaped asterisk is\n+   invalid.\n+--\n++\n+In addition, a pathname matches a pattern if the pathname with any\n+number of its final pathname components removed matches the pattern.\n+For example, the pattern \"`foo/*bar`\" matches \"`foo/asdfbar`\" and\n+\"`foo/bar/baz`\" but not \"`foo/barx`\".\n \n ifndef::git-format-patch[]\n -R::\n-- \n2.11.0.390.gc69c2f50cf-goog\n\n"},{"id":"309199","messageId":"xmqq60lmpb4j.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"17d48ccd-fd19-3922-8ee8-af6558d22632@google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-11T02:46:04Z","receivedAt":"2017-01-11T02:46:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n> I was looking at the code to see how the two file formats differed and\n> noticed that match_order() doesn't set the WM_PATHNAME flag when it\n> calls wildmatch().  That's unintentional (a bug), right?\n\nIt has been that way from day one IIRC even before we introduced\nwildmatch()---IOW it may be intentional that the current code that\nuses wildmatch() does not use WM_PATHNAME.\n\n"},{"id":"309216","messageId":"20170111144158.ef6kle3vw3ejgmut@sigill.intra.peff.net","threadId":"44843","inReplyTo":"xmqqtw96pno0.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-11T14:41:59Z","receivedAt":"2017-01-11T14:42:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 10, 2017 at 02:15:11PM -0800, Junio C Hamano wrote:\n\n> Richard Hansen <hansenr@google.com> writes:\n> \n> >> A related tangent.\n> >>\n> >> I wonder if anything that uses git_config_pathname() should be\n> >> relative to GIT_DIR when it is not absolute.\n> >\n> > I think so.  (For bare repositories anyway; non-bare should be\n> > relative to GIT_WORK_TREE.)  Perhaps git_config_pathname() itself\n> > should convert relative paths to absolute so that every pathname\n> > setting automatically works without changing any calling code.\n> \n> Yes, that was what I was alluding to.  We might have to wait until\n> major version boundary to do so, but I think that it is the sensible\n> way forward in the longer term to convert relative to absolute in\n> git_config_pathname().\n\nYeah, I'd agree.\n\nI'm undecided on whether it would need to happen at a major version\nbump. The existing semantics are fairly insane, and would cause a lot of\nconfusing breakages. We can imagine use of relative paths in a bare\nrepository falls into one of a few categories:\n\n  1. The user generally runs by \"cd /path/to/bare.git && git ...\". This\n     would be unaffected, as relative and $GIT_DIR are the same.\n\n  2. The user runs via \"cd /path/to/bare.git/some-subdir\". This would be\n     broken, but I have trouble imagining that they really wanted to\n     read something like \"objects/orderfile\".\n\n  3. The user runs via \"GIT_DIR=/path/to/bare.git\" from various\n     directories. This case is probably horribly broken, as things like\n     diff.orderFile will complain if they ever run from a directory that\n     doesn't have the order file.\n\n  4. They run GIT_DIR=/path/to/bare.git from a consistent origin\n     directory. This _does_ work, and we'd be breaking it. Though I kind\n     of question why the config in $GIT_DIR is meant to apply to a file\n     in a totally unrelated directory.\n\n     I suppose somebody could be relying on the behavior where setting\n     GIT_DIR uses the current directory as the working tree (i.e., if\n     core.bare is \"true\" in bare.git). But then, we'd consider their\n     working directory as the working tree and read from that anyway. So\n     the behavior would stay the same.\n\nSo I dunno. I do hate to break even corner cases, but I'm having trouble\nimagining the scenario where somebody is actually using the current\nbehavior in a useful way.\n\n-Peff\n"},{"id":"309219","messageId":"21b416ae-8bf6-4f82-25d3-e51a574e7746@google.com","threadId":"44843","inReplyTo":"xmqq60lmpb4j.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-11T17:24:57Z","receivedAt":"2017-01-11T17:25:28Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-10 21:46, Junio C Hamano wrote:\n> Richard Hansen <hansenr@google.com> writes:\n>\n>> I was looking at the code to see how the two file formats differed and\n>> noticed that match_order() doesn't set the WM_PATHNAME flag when it\n>> calls wildmatch().  That's unintentional (a bug), right?\n>\n> It has been that way from day one IIRC even before we introduced\n> wildmatch()---IOW it may be intentional that the current code that\n> uses wildmatch() does not use WM_PATHNAME.\n\nYou are the original author (af5323e027 2005-05-30).  Do you remember \nwhat your intention was?\n\nI would like to change it to pass WM_PATHNAME, but I'm not sure if that \nwould break anyone.  I'm guessing probably not, because users probably \nexpect WM_PATHNAME and would be surprised (like I was) to learn otherwise.\n\nIf we want to keep it as-is, I'll have to adjust [PATCH v2 2/2].\n\n-Richard\n"},{"id":"309222","messageId":"xmqqwpe1o43k.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"21b416ae-8bf6-4f82-25d3-e51a574e7746@google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-11T18:15:27Z","receivedAt":"2017-01-11T18:15:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n> On 2017-01-10 21:46, Junio C Hamano wrote:\n>> Richard Hansen <hansenr@google.com> writes:\n>>\n>>> I was looking at the code to see how the two file formats differed and\n>>> noticed that match_order() doesn't set the WM_PATHNAME flag when it\n>>> calls wildmatch().  That's unintentional (a bug), right?\n>>\n>> It has been that way from day one IIRC even before we introduced\n>> wildmatch()---IOW it may be intentional that the current code that\n>> uses wildmatch() does not use WM_PATHNAME.\n>\n> You are the original author (af5323e027 2005-05-30).  Do you remember\n> what your intention was?\n\nYes.  \n\nBack then we didn't even have wildmatch(), and used fnmatch()\ninstead, so forcing FNM_PATHNAME would have meant that people\nwouldn't be able to say \"foo*bar\" to match \"foo/other/bar\"; with\nwildmatch, \"foo**bar\" lets you defeat WM_PATHNAME so having\nWM_PATHNAME always in effect is less of an issue, but with\nfnmatch(), having FNM_PATHNAME always in effect has a lot of\ndownside.\n\nI'd expect that orderfile people have today will be broken and\nrequire tweaking if you switched WM_PATHNAME on.\n"},{"id":"309224","messageId":"2fb4296d-f084-4a76-44f3-7dc7d7cca7b1@google.com","threadId":"44843","inReplyTo":"xmqqwpe1o43k.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-11T18:36:41Z","receivedAt":"2017-01-11T18:36:48Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"On 2017-01-11 13:15, Junio C Hamano wrote:\n> Richard Hansen <hansenr@google.com> writes:\n>\n>> On 2017-01-10 21:46, Junio C Hamano wrote:\n>>> Richard Hansen <hansenr@google.com> writes:\n>>>\n>>>> I was looking at the code to see how the two file formats differed and\n>>>> noticed that match_order() doesn't set the WM_PATHNAME flag when it\n>>>> calls wildmatch().  That's unintentional (a bug), right?\n>>>\n>>> It has been that way from day one IIRC even before we introduced\n>>> wildmatch()---IOW it may be intentional that the current code that\n>>> uses wildmatch() does not use WM_PATHNAME.\n>>\n>> You are the original author (af5323e027 2005-05-30).  Do you remember\n>> what your intention was?\n>\n> Yes.\n>\n> Back then we didn't even have wildmatch(), and used fnmatch()\n> instead, so forcing FNM_PATHNAME would have meant that people\n> wouldn't be able to say \"foo*bar\" to match \"foo/other/bar\"; with\n> wildmatch, \"foo**bar\" lets you defeat WM_PATHNAME so having\n> WM_PATHNAME always in effect is less of an issue, but with\n> fnmatch(), having FNM_PATHNAME always in effect has a lot of\n> downside.\n\nAh, that makes sense.\n\n>\n> I'd expect that orderfile people have today will be broken and\n> require tweaking if you switched WM_PATHNAME on.\n\nOK, so we don't want to turn on WM_PATHNAME unless we do it for a new \nmajor version.\n\nI'll do another re-roll and document the non-WM_PATHNAME behavior. \nPerhaps I'll encourage users to prefer ** over * if they want to match \nslash (even though they are equivalent) so that migration is easier if \nwe ever do turn on WM_PATHNAME.\n\n-Richard\n"},{"id":"309230","messageId":"xmqqbmvdnwrc.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"20170111144158.ef6kle3vw3ejgmut@sigill.intra.peff.net","subject":"Re: [PATCH 1/2] diff: document behavior of relative diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-11T20:53:59Z","receivedAt":"2017-01-11T20:55:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Jan 10, 2017 at 02:15:11PM -0800, Junio C Hamano wrote:\n>\n>> Richard Hansen <hansenr@google.com> writes:\n>> ...\n>> > I think so.  (For bare repositories anyway; non-bare should be\n>> > relative to GIT_WORK_TREE.)  Perhaps git_config_pathname() itself\n>> > should convert relative paths to absolute so that every pathname\n>> > setting automatically works without changing any calling code.\n>> \n>> Yes, that was what I was alluding to.  We might have to wait until\n>> major version boundary to do so, but I think that it is the sensible\n>> way forward in the longer term to convert relative to absolute in\n>> git_config_pathname().\n>\n> Yeah, I'd agree.\n>\n> I'm undecided on whether it would need to happen at a major version\n> bump. ...\n>\n> So I dunno. I do hate to break even corner cases, but I'm having trouble\n> imagining the scenario where somebody is actually using the current\n> behavior in a useful way.\n\nThanks for a detailed analysis (I probably should have spelt them\nout when I said \"we might have to\" to save you the trouble).\n\n"},{"id":"309232","messageId":"xmqq7f61nw5u.fsf@gitster.mtv.corp.google.com","threadId":"44843","inReplyTo":"2fb4296d-f084-4a76-44f3-7dc7d7cca7b1@google.com","subject":"Re: [PATCH 2/2] diff: document the pattern format for diff.orderFile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-01-11T21:06:53Z","receivedAt":"2017-01-11T21:18:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Hansen <hansenr@google.com> writes:\n\n>> Back then we didn't even have wildmatch(), and used fnmatch()\n>> instead, so forcing FNM_PATHNAME would have meant that people\n>> wouldn't be able to say \"foo*bar\" to match \"foo/other/bar\"; with\n>> wildmatch, \"foo**bar\" lets you defeat WM_PATHNAME so having\n>> WM_PATHNAME always in effect is less of an issue, but with\n>> fnmatch(), having FNM_PATHNAME always in effect has a lot of\n>> downside.\n>\n> Ah, that makes sense.\n>>\n>> I'd expect that orderfile people have today will be broken and\n>> require tweaking if you switched WM_PATHNAME on.\n>\n> OK, so we don't want to turn on WM_PATHNAME unless we do it for a new\n> major version.\n\nI do agree with you that if we were starting Git from scratch, or at\nleast if we were adding diff.orderfile feature today, we would have\nused wildmatch(WM_PATHNAME) for this matching.  We would also have\nused the same parser as used to read the exclude files (and when we\nsee negative matching entries in the parsed result, either errored\nout or ignored them with warning).  That kind of change unfortunately\nwould require a major version bump, I am afraid.\n"},{"id":"309454","messageId":"20170115221631.78838-1-hansenr@google.com","threadId":"44843","inReplyTo":"20170111015720.111223-1-hansenr@google.com","subject":"[PATCH v3 0/2] diff orderfile documentation improvements","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-15T22:16:29Z","receivedAt":"2017-01-15T22:17:10Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Changes from v2:\n  * The orderfile feature doesn't set the WM_PATHNAME flag when it\n    calls wildmatch(), so document the pattern format accordingly.\n\nRichard Hansen (2):\n  diff: document behavior of relative diff.orderFile\n  diff: document the format of the -O (diff.orderFile) file\n\n Documentation/diff-config.txt  |  7 ++++---\n Documentation/diff-options.txt | 34 ++++++++++++++++++++++++++++++++--\n 2 files changed, 36 insertions(+), 5 deletions(-)\n\n-- \n2.11.0.483.g087da7b7c-goog\n\n"},{"id":"309455","messageId":"20170115221631.78838-2-hansenr@google.com","threadId":"44843","inReplyTo":"20170115221631.78838-1-hansenr@google.com","subject":"[PATCH v3 1/2] diff: document behavior of relative diff.orderFile","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-15T22:16:30Z","receivedAt":"2017-01-15T22:17:13Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Document that a relative pathname for diff.orderFile is interpreted as\nrelative to the top-level work directory.\n\nSigned-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/diff-config.txt | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 58f4bd6af..875212045 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -101,6 +101,8 @@ diff.noprefix::\n diff.orderFile::\n \tFile indicating how to order files within a diff, using\n \tone shell glob pattern per line.\n+\tIf `diff.orderFile` is a relative pathname, it is treated as\n+\trelative to the top of the work tree.\n \tCan be overridden by the '-O' option to linkgit:git-diff[1].\n \n diff.renameLimit::\n-- \n2.11.0.483.g087da7b7c-goog\n\n"},{"id":"309456","messageId":"20170115221631.78838-3-hansenr@google.com","threadId":"44843","inReplyTo":"20170115221631.78838-1-hansenr@google.com","subject":"[PATCH v3 2/2] diff: document the format of the -O (diff.orderFile) file","fromName":"Richard Hansen","fromEmail":"hansenr@google.com","sentAt":"2017-01-15T22:16:31Z","receivedAt":"2017-01-15T22:17:16Z","isPatch":true,"sender":{"key":"rhansen@rhansen.org","avatar":null},"body":"Signed-off-by: Richard Hansen <hansenr@google.com>\n---\n Documentation/diff-config.txt  |  5 ++---\n Documentation/diff-options.txt | 34 ++++++++++++++++++++++++++++++++--\n 2 files changed, 34 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt\nindex 875212045..9e4111320 100644\n--- a/Documentation/diff-config.txt\n+++ b/Documentation/diff-config.txt\n@@ -99,11 +99,10 @@ diff.noprefix::\n \tIf set, 'git diff' does not show any source or destination prefix.\n \n diff.orderFile::\n-\tFile indicating how to order files within a diff, using\n-\tone shell glob pattern per line.\n+\tFile indicating how to order files within a diff.\n+\tSee the '-O' option to linkgit:git-diff[1] for details.\n \tIf `diff.orderFile` is a relative pathname, it is treated as\n \trelative to the top of the work tree.\n-\tCan be overridden by the '-O' option to linkgit:git-diff[1].\n \n diff.renameLimit::\n \tThe number of files to consider when performing the copy/rename\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex e6215c372..d4fb70704 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -466,11 +466,41 @@ information.\n endif::git-format-patch[]\n \n -O<orderfile>::\n-\tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n+\tControl the order in which files appear in the output.\n \tThis overrides the `diff.orderFile` configuration variable\n \t(see linkgit:git-config[1]).  To cancel `diff.orderFile`,\n \tuse `-O/dev/null`.\n++\n+The output order is determined by the order of glob patterns in\n+<orderfile>.\n+All files with pathnames that match the first pattern are output\n+first, all files with pathnames that match the second pattern (but not\n+the first) are output next, and so on.\n+All files with pathnames that do not match any pattern are output\n+last, as if there was an implicit match-all pattern at the end of the\n+file.\n+If multiple pathnames have the same rank (they match the same pattern\n+but no earlier patterns), their output order relative to each other is\n+the normal order.\n++\n+<orderfile> is parsed as follows:\n++\n+--\n+ - Blank lines are ignored, so they can be used as separators for\n+   readability.\n+\n+ - Lines starting with a hash (\"`#`\") are ignored, so they can be used\n+   for comments.  Add a backslash (\"`\\`\") to the beginning of the\n+   pattern if it starts with a hash.\n+\n+ - Each other line contains a single pattern.\n+--\n++\n+Patterns have the same syntax and semantics as patterns used for\n+fnmantch(3) without the FNM_PATHNAME flag, except a pathname also\n+matches a pattern if removing any number of the final pathname\n+components matches the pattern.  For example, the pattern \"`foo*bar`\"\n+matches \"`fooasdfbar`\" and \"`foo/bar/baz/asdf`\" but not \"`foobarx`\".\n \n ifndef::git-format-patch[]\n -R::\n-- \n2.11.0.483.g087da7b7c-goog\n\n"}]}