{"thread":{"id":"50740","subject":"[BUG] Suspected with double asterisk in conditional include pattern","startedAt":"2019-03-14T17:30:57Z","lastAt":"2019-04-30T22:07:19Z","messageCount":9,"participants":["Jason Karns","Taylor Blau","Nguyễn Thái Ngọc Duy","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"371527","messageId":"CAKNmmv26G05GO7hG9bNvMsjpuUMHZRA+2f94TuG2wDNUwNhHkw@mail.gmail.com","threadId":"50740","inReplyTo":null,"subject":"[BUG] Suspected with double asterisk in conditional include pattern","fromName":"Jason Karns","fromEmail":"jason.karns@gmail.com","sentAt":"2019-03-14T17:30:43Z","receivedAt":"2019-03-14T17:30:57Z","isPatch":false,"sender":{"key":"jason.karns@gmail.com","avatar":"https://gravatar.com/avatar/c86e80bb1929ad0ea739f79f04d349adfa550d010fde1bd1ea413b6c277e850f?d=mp&s=160"},"body":"Hello,\n\nI believe I've encountered a bug regarding the use of double asterisk\n( /**/ ) within includeIf patterns.\n\ngit-config man pages state that\n\n    **/ and /**, that can match multiple path components\n\nThey then refer to the gitignore man pages which further define\nsupported wildcard patterns:\n\n    A slash followed by two consecutive asterisks then a slash matches\nzero or more directories.\n    For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n\nMy understanding of these docs are that the pattern\n`/usr/local/**/Homebrew/` ought to match\nboth`/usr/local/cache/Homebrew/foo` and `/usr/local/Homebrew/foo`.\n\nHowever, given the following conditional include rule:\n\n    [includeIf \"gitdir:/usr/local/**/Homebrew/\"]\n\nThe external config file is successfully included while in repo\n`/usr/local/cache/Homebrew/foo` but NOT `/usr/local/Homebrew/foo`.\n\nIf I change the pattern to `**/Homebrew/**`, then the pattern matches\nboth desired repos. So it would seem that the `/**/` does not match 0\ndirectories when the pattern begins with a slash.\n\nThank you,\nJason\n"},{"id":"372270","messageId":"20190322190400.GD12155@Taylors-MacBook-Pro.local","threadId":"50740","inReplyTo":"CAKNmmv26G05GO7hG9bNvMsjpuUMHZRA+2f94TuG2wDNUwNhHkw@mail.gmail.com","subject":"Re: [BUG] Suspected with double asterisk in conditional include pattern","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2019-03-22T19:04:00Z","receivedAt":"2019-03-22T19:04:04Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"Hi Jason,\n\nOn Thu, Mar 14, 2019 at 01:30:43PM -0400, Jason Karns wrote:\n> Hello,\n>\n> I believe I've encountered a bug regarding the use of double asterisk\n> ( /**/ ) within includeIf patterns.\n>\n> git-config man pages state that\n>\n>     **/ and /**, that can match multiple path components\n>\n> They then refer to the gitignore man pages which further define\n> supported wildcard patterns:\n>\n>     A slash followed by two consecutive asterisks then a slash matches\n> zero or more directories.\n>     For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n>\n> My understanding of these docs are that the pattern\n> `/usr/local/**/Homebrew/` ought to match\n> both`/usr/local/cache/Homebrew/foo` and `/usr/local/Homebrew/foo`.\n>\n> However, given the following conditional include rule:\n>\n>     [includeIf \"gitdir:/usr/local/**/Homebrew/\"]\n\nFor what it's worth, Git LFS's implementation of the wildmatch\nalgorithm [1] exhibits the same behavior (i.e., that it does _not_ match\nthose double stars in the middle of the pathspec).\n\nHere are the tests I added to double check:\n\n\t{\n\t\tPattern: `/usr/local/**/Homebrew/`,\n\t\tSubject: `/usr/local/cache/Homebrew/foo`,\n\t\tMatch:   false,\n\t},\n\t{\n\t\tPattern: `/usr/local/**/Homebrew/`,\n\t\tSubject: `/usr/local/Homebrew/foo`,\n\t\tMatch:   false,\n\t},\n\nAnd they passed, indicating that neither of the above subjects are a\nmatch for the pattern '/usr/local/**/Homebrew'. I was suspicious that\nchanging the pattern to '/usr/local/**/Homebrew/*' might have caused it\nto match, but it did not.\n\nBut this isn't really telling us anything that we don't know. What's\ninteresting is that '/usr/local/**/Homebrew' _does_ match\n'/usr/local/Homebrew' and '/usr/local/cache/Homebrew'. I think that this\nis consistent with [2]:\n\n  A slash followed by two consecutive asterisks then a slash matches\n  zero or more directories. For example, \"a/**/b\" matches \"a/b\",\n  \"a/x/b\", \"a/x/y/b\" and so on.\n\nSo I think that there _is_ a bug here, but not the one you suggested.\nRather, I think that the bug is that with the _trailing_ wildcard, the\npathspec doesn't accept '/usr/local/cache/Homebrew/a'.\n\nThanks,\nTaylor\n\n[1]: https://github.com/git-lfs/wildmatch\n[2]: https://git-scm.com/docs/gitignore\n"},{"id":"372294","messageId":"20190323034535.23364-1-pclouds@gmail.com","threadId":"50740","inReplyTo":"CAKNmmv26G05GO7hG9bNvMsjpuUMHZRA+2f94TuG2wDNUwNhHkw@mail.gmail.com","subject":"[PATCH] config: correct '**' matching in includeIf patterns","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2019-03-23T03:45:35Z","receivedAt":"2019-03-23T03:45:47Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"The current wildmatch() call for includeIf's gitdir pattern does not\npass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_\nthe same as '**' (because '*' also matches slashes) with one exception:\n\n'/**/' can match a single slash. The pattern 'foo/**/bar' matches\n'foo/bar'.\n\nBut '/*/', which is essentially what wildmatch engine sees without\nWM_PATHNAME, has to match two slashes (and '*' matches nothing). Which\nmeans 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.\n\nThe result of this is the current wildmatch() call works most of the\ntime until the user depends on '/**/' matching no path component. The\nfix is straightforward.\n\nReported-by: Jason Karns <jason.karns@gmail.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Sorry I didn't notice this until Taylor's reply. Not sure how to\n explain git-lfs behavior though.\n\n config.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/config.c b/config.c\nindex 0f0cdd8c0f..c2846df3f1 100644\n--- a/config.c\n+++ b/config.c\n@@ -242,7 +242,7 @@ static int include_by_gitdir(const struct config_options *opts,\n \t}\n \n \tret = !wildmatch(pattern.buf + prefix, text.buf + prefix,\n-\t\t\t icase ? WM_CASEFOLD : 0);\n+\t\t\t WM_PATHNAME | (icase ? WM_CASEFOLD : 0));\n \n \tif (!ret && !already_tried_absolute) {\n \t\t/*\n-- \n2.21.0.548.gd3c7d92dc2\n\n"},{"id":"372360","messageId":"xmqq7ecoph14.fsf@gitster-ct.c.googlers.com","threadId":"50740","inReplyTo":"20190323034535.23364-1-pclouds@gmail.com","subject":"Re: [PATCH] config: correct '**' matching in includeIf patterns","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-24T12:56:39Z","receivedAt":"2019-03-24T12:58:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> The current wildmatch() call for includeIf's gitdir pattern does not\n> pass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_\n> the same as '**' (because '*' also matches slashes) with one exception:\n>\n> '/**/' can match a single slash. The pattern 'foo/**/bar' matches\n> 'foo/bar'.\n>\n> But '/*/', which is essentially what wildmatch engine sees without\n> WM_PATHNAME, has to match two slashes (and '*' matches nothing). Which\n> means 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.\n>\n> The result of this is the current wildmatch() call works most of the\n> time until the user depends on '/**/' matching no path component. The\n> fix is straightforward.\n>\n> Reported-by: Jason Karns <jason.karns@gmail.com>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  Sorry I didn't notice this until Taylor's reply. Not sure how to\n>  explain git-lfs behavior though.\n>\n>  config.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nThe analysis above is very good, and the updated code is a natural\nconsequence of the analysis; very well done.\n\nWould it be easy to protect this fix from future breakages with a\ntest or two?\n\n> diff --git a/config.c b/config.c\n> index 0f0cdd8c0f..c2846df3f1 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -242,7 +242,7 @@ static int include_by_gitdir(const struct config_options *opts,\n>  \t}\n>  \n>  \tret = !wildmatch(pattern.buf + prefix, text.buf + prefix,\n> -\t\t\t icase ? WM_CASEFOLD : 0);\n> +\t\t\t WM_PATHNAME | (icase ? WM_CASEFOLD : 0));\n>  \n>  \tif (!ret && !already_tried_absolute) {\n>  \t\t/*\n"},{"id":"372363","messageId":"20190324131755.26821-1-pclouds@gmail.com","threadId":"50740","inReplyTo":"20190323034535.23364-1-pclouds@gmail.com","subject":"[PATCH v2] config: correct '**' matching in includeIf patterns","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2019-03-24T13:17:55Z","receivedAt":"2019-03-24T13:19:00Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"The current wildmatch() call for includeIf's gitdir pattern does not\npass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_\nthe same as '**' (because '*' also matches slashes) with one exception:\n\n'/**/' can match a single slash. The pattern 'foo/**/bar' matches\n'foo/bar'.\n\nBut '/*/', which is essentially what wildmatch engine sees without\nWM_PATHNAME, has to match two slashes (and '*' matches nothing). Which\nmeans 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.\n\nThe result of this is the current wildmatch() call works most of the\ntime until the user depends on '/**/' matching no path component. And\nalso '*' matches slashes while it should not, but people probably\nhaven't noticed this yet. The fix is straightforward.\n\nReported-by: Jason Karns <jason.karns@gmail.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n v2 adds a test. My laziness can't get past Junio.\n\n config.c                  |  2 +-\n t/t1305-config-include.sh | 13 +++++++++++++\n 2 files changed, 14 insertions(+), 1 deletion(-)\n\ndiff --git a/config.c b/config.c\nindex 0f0cdd8c0f..c2846df3f1 100644\n--- a/config.c\n+++ b/config.c\n@@ -242,7 +242,7 @@ static int include_by_gitdir(const struct config_options *opts,\n \t}\n \n \tret = !wildmatch(pattern.buf + prefix, text.buf + prefix,\n-\t\t\t icase ? WM_CASEFOLD : 0);\n+\t\t\t WM_PATHNAME | (icase ? WM_CASEFOLD : 0));\n \n \tif (!ret && !already_tried_absolute) {\n \t\t/*\ndiff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh\nindex 635918505d..4d6e70c11d 100755\n--- a/t/t1305-config-include.sh\n+++ b/t/t1305-config-include.sh\n@@ -229,6 +229,19 @@ test_expect_success 'conditional include, early config reading' '\n \t)\n '\n \n+test_expect_success 'conditional include with /**/' '\n+\tmkdir foo/bar &&\n+\tgit init foo/bar/repo &&\n+\t(\n+\t\tcd foo/bar/repo &&\n+\t\techo \"[includeIf \\\"gitdir:**/foo/**/bar/**\\\"]path=bar7\" >>.git/config &&\n+\t\techo \"[test]seven=7\" >.git/bar7 &&\n+\t\techo 7 >expect &&\n+\t\tgit config test.seven >actual &&\n+\t\ttest_cmp expect actual\n+\t)\n+'\n+\n test_expect_success SYMLINKS 'conditional include, set up symlinked $HOME' '\n \tmkdir real-home &&\n \tln -s real-home home &&\n-- \n2.21.0.479.g47ac719cd3\n\n"},{"id":"372393","messageId":"xmqqa7hjofc8.fsf@gitster-ct.c.googlers.com","threadId":"50740","inReplyTo":"20190324131755.26821-1-pclouds@gmail.com","subject":"Re: [PATCH v2] config: correct '**' matching in includeIf patterns","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-25T02:30:47Z","receivedAt":"2019-03-25T02:30:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> The current wildmatch() call for includeIf's gitdir pattern does not\n> pass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_\n> the same as '**' (because '*' also matches slashes) with one exception:\n>\n> '/**/' can match a single slash. The pattern 'foo/**/bar' matches\n> 'foo/bar'.\n>\n> But '/*/', which is essentially what wildmatch engine sees without\n> WM_PATHNAME, has to match two slashes (and '*' matches nothing). Which\n> means 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.\n>\n> The result of this is the current wildmatch() call works most of the\n> time until the user depends on '/**/' matching no path component. And\n> also '*' matches slashes while it should not, but people probably\n> haven't noticed this yet. The fix is straightforward.\n\n> +test_expect_success 'conditional include with /**/' '\n> +\tmkdir foo/bar &&\n> +\tgit init foo/bar/repo &&\n> +\t(\n> +\t\tcd foo/bar/repo &&\n> +\t\techo \"[includeIf \\\"gitdir:**/foo/**/bar/**\\\"]path=bar7\" >>.git/config &&\n> +\t\techo \"[test]seven=7\" >.git/bar7 &&\n> +\t\techo 7 >expect &&\n> +\t\tgit config test.seven >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n\nThat's cute ;-)\n\nThanks for quickly working on the fix with an incredibly short\nturnaround time since the initial report.\n\nP.S. I expect to be offline for most of the week (packing, moving\nand unpacking.  Even though the places packing and unpacking happens\nare within 1 kilometer radius, that does not make it less hassle\nX-<).  See you guys next month.\n"},{"id":"372475","messageId":"nycvar.QRO.7.76.6.1903252233580.41@tvgsbejvaqbjf.bet","threadId":"50740","inReplyTo":"20190324131755.26821-1-pclouds@gmail.com","subject":"Re: [PATCH v2] config: correct '**' matching in includeIf patterns","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-03-25T21:40:33Z","receivedAt":"2019-03-25T21:40:56Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Duy,\n\nOn Sun, 24 Mar 2019, Nguyễn Thái Ngọc Duy wrote:\n\n> diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh\n> index 635918505d..4d6e70c11d 100755\n> --- a/t/t1305-config-include.sh\n> +++ b/t/t1305-config-include.sh\n> @@ -229,6 +229,19 @@ test_expect_success 'conditional include, early config reading' '\n>  \t)\n>  '\n>\n> +test_expect_success 'conditional include with /**/' '\n> +\tmkdir foo/bar &&\n\nThis does assume that no previous test case created `bar`, but that `foo`\nwas created (which makes it harder to use `--run=<N>` for quicker\ntesting/debugging). It would be better to use\n\n\tmkdir -p foo/bar &&\n\nhere. Or *even* better...\n\n> +\tgit init foo/bar/repo &&\n\n... just drop the `mkdir foo/bar`, as `git init foo/bar/repo` has not the\nslightest problem creating the intermediate directories.\n\n> +\t(\n> +\t\tcd foo/bar/repo &&\n> +\t\techo \"[includeIf \\\"gitdir:**/foo/**/bar/**\\\"]path=bar7\" >>.git/config &&\n\nThis line is longer than the 80 columns asked for in SubmittingPatches,\nand while you have to wrap the line anyway, why not avoid the `cd`, too?\n\n\techo \"[includeIf \\\"gitdir:**/foo/**/bar/**\\\"]path=bar7\" \\\n\t\t>>foo/bar/repo/.git/config &&\n\techo \"[test]seven=7\" >foo/bar/repo/.git/bar7 &&\n\techo 7 >expect &&\n\tgit -C foo/bar/repo config test.seven >actual &&\n\ttest_cmp expect actual\n\nCiao,\nJohannes\n\n> +\t\techo \"[test]seven=7\" >.git/bar7 &&\n> +\t\techo 7 >expect &&\n> +\t\tgit config test.seven >actual &&\n> +\t\ttest_cmp expect actual\n> +\t)\n> +'\n> +\n>  test_expect_success SYMLINKS 'conditional include, set up symlinked $HOME' '\n>  \tmkdir real-home &&\n>  \tln -s real-home home &&\n> --\n> 2.21.0.479.g47ac719cd3\n>\n>\n"},{"id":"372506","messageId":"20190326094101.26294-1-pclouds@gmail.com","threadId":"50740","inReplyTo":"20190324131755.26821-1-pclouds@gmail.com","subject":"[PATCH v3] config: correct '**' matching in includeIf patterns","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2019-03-26T09:41:01Z","receivedAt":"2019-03-26T09:42:03Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"The current wildmatch() call for includeIf's gitdir pattern does not\npass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_\nthe same as '**' (because '*' also matches slashes) with one exception:\n\n'/**/' can match a single slash. The pattern 'foo/**/bar' matches\n'foo/bar'.\n\nBut '/*/', which is essentially what wildmatch engine sees without\nWM_PATHNAME, has to match two slashes (and '*' matches nothing). Which\nmeans 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.\n\nThe result of this is the current wildmatch() call works most of the\ntime until the user depends on '/**/' matching no path component. And\nalso '*' matches slashes while it should not, but people probably\nhaven't noticed this yet. The fix is straightforward.\n\nReported-by: Jason Karns <jason.karns@gmail.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n v3 updates the test to avoid mkdir and cd, and break long lines.\n\n config.c                  |  2 +-\n t/t1305-config-include.sh | 13 +++++++++++++\n 2 files changed, 14 insertions(+), 1 deletion(-)\n\ndiff --git a/config.c b/config.c\nindex 0f0cdd8c0f..c2846df3f1 100644\n--- a/config.c\n+++ b/config.c\n@@ -242,7 +242,7 @@ static int include_by_gitdir(const struct config_options *opts,\n \t}\n \n \tret = !wildmatch(pattern.buf + prefix, text.buf + prefix,\n-\t\t\t icase ? WM_CASEFOLD : 0);\n+\t\t\t WM_PATHNAME | (icase ? WM_CASEFOLD : 0));\n \n \tif (!ret && !already_tried_absolute) {\n \t\t/*\ndiff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh\nindex 635918505d..579a86b7f8 100755\n--- a/t/t1305-config-include.sh\n+++ b/t/t1305-config-include.sh\n@@ -229,6 +229,19 @@ test_expect_success 'conditional include, early config reading' '\n \t)\n '\n \n+test_expect_success 'conditional include with /**/' '\n+\tREPO=foo/bar/repo &&\n+\tgit init $REPO &&\n+\tcat >>$REPO/.git/config <<-\\EOF &&\n+\t[includeIf \"gitdir:**/foo/**/bar/**\"]\n+\tpath=bar7\n+\tEOF\n+\techo \"[test]seven=7\" >$REPO/.git/bar7 &&\n+\techo 7 >expect &&\n+\tgit -C $REPO config test.seven >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success SYMLINKS 'conditional include, set up symlinked $HOME' '\n \tmkdir real-home &&\n \tln -s real-home home &&\n-- \n2.21.0.479.g47ac719cd3\n\n"},{"id":"374719","messageId":"CAKNmmv1Y48zfUZ0TvjDVdVngrMyA1YyNacdNbw7O05_E4FHsbQ@mail.gmail.com","threadId":"50740","inReplyTo":"20190326094101.26294-1-pclouds@gmail.com","subject":"Re: [PATCH v3] config: correct '**' matching in includeIf patterns","fromName":"Jason Karns","fromEmail":"jason.karns@gmail.com","sentAt":"2019-04-30T22:07:06Z","receivedAt":"2019-04-30T22:07:19Z","isPatch":true,"sender":{"key":"jason.karns@gmail.com","avatar":"https://gravatar.com/avatar/c86e80bb1929ad0ea739f79f04d349adfa550d010fde1bd1ea413b6c277e850f?d=mp&s=160"},"body":"On Tue, Mar 26, 2019 at 5:42 AM Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:\n>\n> The current wildmatch() call for includeIf's gitdir pattern does not\n> pass the WM_PATHNAME flag. Without this flag, '*' is treated _almost_\n> the same as '**' (because '*' also matches slashes) with one exception:\n>\n> '/**/' can match a single slash. The pattern 'foo/**/bar' matches\n> 'foo/bar'.\n>\n> But '/*/', which is essentially what wildmatch engine sees without\n> WM_PATHNAME, has to match two slashes (and '*' matches nothing). Which\n> means 'foo/*/bar' cannot match 'foo/bar'. It can only match 'foo//bar'.\n>\n> The result of this is the current wildmatch() call works most of the\n> time until the user depends on '/**/' matching no path component. And\n> also '*' matches slashes while it should not, but people probably\n> haven't noticed this yet. The fix is straightforward.\n>\n> Reported-by: Jason Karns <jason.karns@gmail.com>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  v3 updates the test to avoid mkdir and cd, and break long lines.\n>\n>  config.c                  |  2 +-\n>  t/t1305-config-include.sh | 13 +++++++++++++\n>  2 files changed, 14 insertions(+), 1 deletion(-)\n>\n> diff --git a/config.c b/config.c\n> index 0f0cdd8c0f..c2846df3f1 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -242,7 +242,7 @@ static int include_by_gitdir(const struct config_options *opts,\n>         }\n>\n>         ret = !wildmatch(pattern.buf + prefix, text.buf + prefix,\n> -                        icase ? WM_CASEFOLD : 0);\n> +                        WM_PATHNAME | (icase ? WM_CASEFOLD : 0));\n>\n>         if (!ret && !already_tried_absolute) {\n>                 /*\n> diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh\n> index 635918505d..579a86b7f8 100755\n> --- a/t/t1305-config-include.sh\n> +++ b/t/t1305-config-include.sh\n> @@ -229,6 +229,19 @@ test_expect_success 'conditional include, early config reading' '\n>         )\n>  '\n>\n> +test_expect_success 'conditional include with /**/' '\n> +       REPO=foo/bar/repo &&\n> +       git init $REPO &&\n> +       cat >>$REPO/.git/config <<-\\EOF &&\n> +       [includeIf \"gitdir:**/foo/**/bar/**\"]\n> +       path=bar7\n> +       EOF\n> +       echo \"[test]seven=7\" >$REPO/.git/bar7 &&\n> +       echo 7 >expect &&\n> +       git -C $REPO config test.seven >actual &&\n> +       test_cmp expect actual\n> +'\n> +\n>  test_expect_success SYMLINKS 'conditional include, set up symlinked $HOME' '\n>         mkdir real-home &&\n>         ln -s real-home home &&\n> --\n> 2.21.0.479.g47ac719cd3\n>\n\nThank you all for looking into this! (and your work on git!) It is\nvery much appreciated.\n\nJason\n"}]}