{"thread":{"id":"51976","subject":"[PATCH v2 1/2] format-patch: create leading components of output directory","startedAt":"2019-10-05T08:43:57Z","lastAt":"2019-10-08T09:14:17Z","messageCount":7,"participants":["Bert Wesarg","Junio C Hamano","SZEDER Gábor","Denton Liu"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"383460","messageId":"2b8b000d76a20349f1f9e09260eff91429beebfb.1570264824.git.bert.wesarg@googlemail.com","threadId":"51976","inReplyTo":null,"subject":"[PATCH v2 1/2] format-patch: create leading components of output directory","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-10-05T08:43:51Z","receivedAt":"2019-10-05T08:43:57Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n--- \n\nChangeLog:\n\nv2:\n * squashed and base new tests on 'dl/format-patch-doc-test-cleanup'\n\nCc: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/config/format.txt    |  2 +-\n Documentation/git-format-patch.txt |  3 ++-\n builtin/log.c                      |  8 ++++++++\n t/t4014-format-patch.sh            | 20 ++++++++++++++++++++\n 4 files changed, 31 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config/format.txt b/Documentation/config/format.txt\nindex cb629fa769..40cad9278f 100644\n--- a/Documentation/config/format.txt\n+++ b/Documentation/config/format.txt\n@@ -81,7 +81,7 @@ format.coverLetter::\n \n format.outputDirectory::\n \tSet a custom directory to store the resulting files instead of the\n-\tcurrent working directory.\n+\tcurrent working directory. All directory components will be created.\n \n format.useAutoBase::\n \tA boolean value which lets you enable the `--base=auto` option of\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 0ac56f4b70..2035d4d5d5 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -66,7 +66,8 @@ they are created in the current working directory. The default path\n can be set with the `format.outputDirectory` configuration option.\n The `-o` option takes precedence over `format.outputDirectory`.\n To store patches in the current working directory even when\n-`format.outputDirectory` points elsewhere, use `-o .`.\n+`format.outputDirectory` points elsewhere, use `-o .`. All directory\n+components will be created.\n \n By default, the subject of a single patch is \"[PATCH] \" followed by\n the concatenation of lines from the commit message up to the first blank\ndiff --git a/builtin/log.c b/builtin/log.c\nindex c4b35fdaf9..294534aacb 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -1770,6 +1770,14 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\trev.diffopt.use_color = GIT_COLOR_NEVER;\n \t\tif (use_stdout)\n \t\t\tdie(_(\"standard output, or directory, which one?\"));\n+\t\tswitch (safe_create_leading_directories_const(output_directory)) {\n+\t\tcase SCLD_OK:\n+\t\tcase SCLD_EXISTS:\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tdie(_(\"could not create leading directories \"\n+\t\t\t      \"of '%s'\"), output_directory);\n+\t\t}\n \t\tif (mkdir(output_directory, 0777) < 0 && errno != EEXIST)\n \t\t\tdie_errno(_(\"could not create directory '%s'\"),\n \t\t\t\t  output_directory);\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 83f52614d3..2f2cd6fea6 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -1606,6 +1606,26 @@ test_expect_success 'From line has expected format' '\n \ttest_cmp from filtered\n '\n \n+test_expect_success 'format-patch -o with no leading directories' '\n+\trm -fr patches &&\n+\tgit format-patch -o patches master..side &&\n+\tgit rev-list master..side >list &&\n+\ttest_line_count = $(ls patches | wc -l) list\n+'\n+\n+test_expect_success 'format-patch -o with leading existing directories' '\n+\tgit format-patch -o patches/side master..side &&\n+\tgit rev-list master..side >list &&\n+\ttest_line_count = $(ls patches/side | wc -l) list\n+'\n+\n+test_expect_success 'format-patch -o with leading non-existing directories' '\n+\trm -fr patches &&\n+\tgit format-patch -o patches/side master..side &&\n+\tgit rev-list master..side >list &&\n+\ttest_line_count = $(ls patches/side | wc -l) list\n+'\n+\n test_expect_success 'format-patch format.outputDirectory option' '\n \ttest_config format.outputDirectory patches &&\n \trm -fr patches &&\n-- \n2.23.0.11.g242cf7f110\n\n"},{"id":"383461","messageId":"8cb452eddda2643b257ea23f67acd384f1dbb846.1570264824.git.bert.wesarg@googlemail.com","threadId":"51976","inReplyTo":"2b8b000d76a20349f1f9e09260eff91429beebfb.1570264824.git.bert.wesarg@googlemail.com","subject":"[PATCH v2 2/2] [RFC] format-patch: configure a command to generate the output directory name","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-10-05T08:43:52Z","receivedAt":"2019-10-05T08:43:59Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"The 'format.outputDirectory' configuration is only able to store constant\ndirectory names. Though some may use\n\n   $ git format-patch -o $(createdir) …\n\nto name the directory dynamically. Provide a new configuration to be able\nto store such a command too.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n--- \n\nChangeLog:\n\nv2:\n * rephrase motivation\n\nCc: Alexander Kuleshov <kuleshovmail@gmail.com>\nCc: Eric Sunshine <sunshine@sunshineco.com>\nCc: Denton Liu <liu.denton@gmail.com>\nCc: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/config/format.txt    |  5 +++++\n Documentation/git-format-patch.txt |  6 +++++-\n builtin/log.c                      | 24 +++++++++++++++++++++++-\n t/t4014-format-patch.sh            | 25 +++++++++++++++++++++++++\n 4 files changed, 58 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/config/format.txt b/Documentation/config/format.txt\nindex 40cad9278f..420188a1c6 100644\n--- a/Documentation/config/format.txt\n+++ b/Documentation/config/format.txt\n@@ -83,6 +83,11 @@ format.outputDirectory::\n \tSet a custom directory to store the resulting files instead of the\n \tcurrent working directory. All directory components will be created.\n \n+format.outputDirectoryCmd::\n+\tThe command which is used to name a custom directory to store the\n+\tresulting files instead of the current working directory. All directory\n+\tcomponents will be created.\n+\n format.useAutoBase::\n \tA boolean value which lets you enable the `--base=auto` option of\n \tformat-patch by default.\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 2035d4d5d5..4936b9f91d 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -67,7 +67,11 @@ can be set with the `format.outputDirectory` configuration option.\n The `-o` option takes precedence over `format.outputDirectory`.\n To store patches in the current working directory even when\n `format.outputDirectory` points elsewhere, use `-o .`. All directory\n-components will be created.\n+components will be created. The 'format.outputDirectoryCmd' configuration can\n+be used to name a command to produce the directory name programmatically. The\n+command should produce the name to its standard output. The\n+`format.outputDirectory` configuration takes precedence over\n+`format.outputDirectoryCmd`.\n \n By default, the subject of a single patch is \"[PATCH] \" followed by\n the concatenation of lines from the commit message up to the first blank\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 294534aacb..e841306e61 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -775,6 +775,7 @@ static const char *signature = git_version_string;\n static const char *signature_file;\n static int config_cover_letter;\n static const char *config_output_directory;\n+static const char *config_output_directory_cmd;\n \n enum {\n \tCOVER_UNSET,\n@@ -857,6 +858,8 @@ static int git_format_config(const char *var, const char *value, void *cb)\n \t}\n \tif (!strcmp(var, \"format.outputdirectory\"))\n \t\treturn git_config_string(&config_output_directory, var, value);\n+\tif (!strcmp(var, \"format.outputdirectorycmd\"))\n+\t\treturn git_config_string(&config_output_directory_cmd, var, value);\n \tif (!strcmp(var, \"format.useautobase\")) {\n \t\tbase_auto = git_config_bool(var, value);\n \t\treturn 0;\n@@ -1757,8 +1760,27 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \tif (rev.show_notes)\n \t\tinit_display_notes(&rev.notes_opt);\n \n-\tif (!output_directory && !use_stdout)\n+\tif (!output_directory && !use_stdout) {\n+\t\t// outputDirectoryCmd can be preceeded by outputDirectory\n+\t\tif (!config_output_directory && config_output_directory_cmd) {\n+\t\t\tstruct child_process cp = CHILD_PROCESS_INIT;\n+\t\t\tconst char *argv[1];\n+\t\t\tstruct strbuf buf = STRBUF_INIT;\n+\t\t\tint rc;\n+\n+\t\t\targv[0] = config_output_directory_cmd;\n+\t\t\tcp.argv = argv;\n+\t\t\tcp.use_shell = 1;\n+\t\t\trc = capture_command(&cp, &buf, PATH_MAX);\n+\t\t\tif (rc)\n+\t\t\t\tdie(_(\"outputDirectoryCmd command failed: \"\n+\t\t\t\t      \"'%s'\"), config_output_directory_cmd);\n+\t\t\tstrbuf_setlen(&buf, strcspn(buf.buf, \"\\r\\n\"));\n+\t\t\tconfig_output_directory = strbuf_detach(&buf, NULL);\n+\t\t}\n+\n \t\toutput_directory = config_output_directory;\n+\t}\n \n \tif (!use_stdout)\n \t\toutput_directory = set_outdir(prefix, output_directory);\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 2f2cd6fea6..f351d26543 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -1642,6 +1642,31 @@ test_expect_success 'format-patch -o overrides format.outputDirectory' '\n \ttest_path_is_dir patchset\n '\n \n+test_expect_success 'format-patch format.outputDirectoryCmd option' '\n+\ttest_config format.outputDirectoryCmd \"echo patches\" &&\n+\trm -fr patches &&\n+\tgit format-patch master..side &&\n+\tgit rev-list master..side >list &&\n+\ttest_line_count = $(ls patches | wc -l) list\n+'\n+\n+test_expect_success 'format-patch format.outputDirectory overrides format.outputDirectoryCmd' '\n+\ttest_config format.outputDirectoryCmd \"echo patches\" &&\n+\ttest_config format.outputDirectory patchset &&\n+\trm -fr patches patchset &&\n+\tgit format-patch master..side &&\n+\ttest_path_is_missing patches &&\n+\ttest_path_is_dir patchset\n+'\n+\n+test_expect_success 'format-patch -o overrides format.outputDirectoryCmd' '\n+\ttest_config format.outputDirectoryCmd \"echo patches\" &&\n+\trm -fr patches patchset &&\n+\tgit format-patch -o patchset master..side &&\n+\ttest_path_is_missing patches &&\n+\ttest_path_is_dir patchset\n+'\n+\n test_expect_success 'format-patch --base' '\n \tgit checkout patchid &&\n \n-- \n2.23.0.11.g242cf7f110\n\n"},{"id":"383508","messageId":"xmqqa7ae667i.fsf@gitster-ct.c.googlers.com","threadId":"51976","inReplyTo":"2b8b000d76a20349f1f9e09260eff91429beebfb.1570264824.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH v2 1/2] format-patch: create leading components of output directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-10-06T00:57:53Z","receivedAt":"2019-10-06T00:57:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> +\t\tswitch (safe_create_leading_directories_const(output_directory)) {\n> +\t\tcase SCLD_OK:\n> +\t\tcase SCLD_EXISTS:\n> +\t\t\tbreak;\n> +\t\tdefault:\n> +\t\t\tdie(_(\"could not create leading directories \"\n> +\t\t\t      \"of '%s'\"), output_directory);\n> +\t\t}\n>  \t\tif (mkdir(output_directory, 0777) < 0 && errno != EEXIST)\n>  \t\t\tdie_errno(_(\"could not create directory '%s'\"),\n>  \t\t\t\t  output_directory);\n\nThere is a slight discrepancy here in that mkdir(..., 0777) is to\nhonor the umask setting of the user who is running the command and\ndoes not care about anybody else being able to (or unable to) access\nthe resulting directory.  On the other hand, s-c-l-d is (as you can\nguess from the location the function is defined, sha1-file.c) meant\nto be used to create hierarchy _inside_ $GIT_DIR/ in such a way that\nanybody who needs to access the repository can access it (via\ncore.sharedrepository config).\n\nI do not think it matters too much in practice, but\n\n\t$ git format-patch -o $HOME/my/patch/depot\n\nthat creates intermediate levels that can be writable by other\nusers, only because the repository you took the patches from was\nshared with other users, may probably be seen as a security bug.\n"},{"id":"383626","messageId":"20191007210306.GF11529@szeder.dev","threadId":"51976","inReplyTo":"2b8b000d76a20349f1f9e09260eff91429beebfb.1570264824.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH v2 1/2] format-patch: create leading components of output directory","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2019-10-07T21:03:06Z","receivedAt":"2019-10-07T21:03:12Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Sat, Oct 05, 2019 at 10:43:51AM +0200, Bert Wesarg wrote:\n> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\n> index 83f52614d3..2f2cd6fea6 100755\n> --- a/t/t4014-format-patch.sh\n> +++ b/t/t4014-format-patch.sh\n> @@ -1606,6 +1606,26 @@ test_expect_success 'From line has expected format' '\n>  \ttest_cmp from filtered\n>  '\n>  \n> +test_expect_success 'format-patch -o with no leading directories' '\n> +\trm -fr patches &&\n> +\tgit format-patch -o patches master..side &&\n> +\tgit rev-list master..side >list &&\n> +\ttest_line_count = $(ls patches | wc -l) list\n\nThis is sort of a nit...\n\nSo, these tests check that 'git rev-list ...' lists as many commits as\nthe number of files created by 'git format-patch'.  While it doesn't\naffect the tests' correctness, this is subtly different from checking\nthat 'git format-patch' created as many files as the number of commits\nlisted by 'git rev-list'.\n\nConsider how the tests' output would look like on failure:\n'test_line_count' shows an error message that includes the content of\nthe file to be checked, which in this case would consist of a bunch of\ncommit object ids:\n\n  test_line_count: line count for list != 3\n  f7af51d27933a90554b6e9212a7e5d4ad1c74569\n  bd89fce9f5096eb5cad67c342b40818b7e3ce9e4\n\nOn one hand, these object ids won't mean much to anyone who might have\nto debug such a test failure in the future, and on the other these\ntests are about 'git format-patch', not about 'git rev-list'.  If the\ncheck were written like this:\n\n  count=$(git rev-list --count master..side) &&\n  ls patches >list &&\n  test_line_count = $count list\n\nthen the error message on failure would look something like this:\n\n  test_line_count: line count for list != 3\n  0001-first.patch\n  0002-second.patch\n\nwhich, I think, would be more useful.\n\n\n> +'\n> +\n> +test_expect_success 'format-patch -o with leading existing directories' '\n> +\tgit format-patch -o patches/side master..side &&\n> +\tgit rev-list master..side >list &&\n> +\ttest_line_count = $(ls patches/side | wc -l) list\n> +'\n> +\n> +test_expect_success 'format-patch -o with leading non-existing directories' '\n> +\trm -fr patches &&\n> +\tgit format-patch -o patches/side master..side &&\n> +\tgit rev-list master..side >list &&\n> +\ttest_line_count = $(ls patches/side | wc -l) list\n> +'\n> +\n>  test_expect_success 'format-patch format.outputDirectory option' '\n>  \ttest_config format.outputDirectory patches &&\n>  \trm -fr patches &&\n> -- \n> 2.23.0.11.g242cf7f110\n> \n"},{"id":"383648","messageId":"xmqq8spvor7m.fsf@gitster-ct.c.googlers.com","threadId":"51976","inReplyTo":"20191007210306.GF11529@szeder.dev","subject":"Re: [PATCH v2 1/2] format-patch: create leading components of output directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-10-08T03:23:41Z","receivedAt":"2019-10-08T03:23:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder.dev@gmail.com> writes:\n\n> On one hand, these object ids won't mean much to anyone who might have\n> to debug such a test failure in the future, and on the other these\n> tests are about 'git format-patch', not about 'git rev-list'.  If the\n> check were written like this:\n>\n>   count=$(git rev-list --count master..side) &&\n>   ls patches >list &&\n>   test_line_count = $count list\n>\n> then the error message on failure would look something like this:\n>\n>   test_line_count: line count for list != 3\n>   0001-first.patch\n>   0002-second.patch\n>\n> which, I think, would be more useful.\n\nThat's nice attention to the detail ;-)\n"},{"id":"383665","messageId":"CAKPyHN2pX+QnktdWZh7huwnj_6eZ=s06A8mfWhUDKOc+Yn8qZQ@mail.gmail.com","threadId":"51976","inReplyTo":"20191007210306.GF11529@szeder.dev","subject":"Re: [PATCH v2 1/2] format-patch: create leading components of output directory","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2019-10-08T09:06:07Z","receivedAt":"2019-10-08T09:06:21Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Mon, Oct 7, 2019 at 11:03 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:\n>\n> On Sat, Oct 05, 2019 at 10:43:51AM +0200, Bert Wesarg wrote:\n> > diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\n> > index 83f52614d3..2f2cd6fea6 100755\n> > --- a/t/t4014-format-patch.sh\n> > +++ b/t/t4014-format-patch.sh\n> > @@ -1606,6 +1606,26 @@ test_expect_success 'From line has expected format' '\n> >       test_cmp from filtered\n> >  '\n> >\n> > +test_expect_success 'format-patch -o with no leading directories' '\n> > +     rm -fr patches &&\n> > +     git format-patch -o patches master..side &&\n> > +     git rev-list master..side >list &&\n> > +     test_line_count = $(ls patches | wc -l) list\n>\n> This is sort of a nit...\n>\n> So, these tests check that 'git rev-list ...' lists as many commits as\n> the number of files created by 'git format-patch'.  While it doesn't\n> affect the tests' correctness, this is subtly different from checking\n> that 'git format-patch' created as many files as the number of commits\n> listed by 'git rev-list'.\n>\n> Consider how the tests' output would look like on failure:\n> 'test_line_count' shows an error message that includes the content of\n> the file to be checked, which in this case would consist of a bunch of\n> commit object ids:\n>\n>   test_line_count: line count for list != 3\n>   f7af51d27933a90554b6e9212a7e5d4ad1c74569\n>   bd89fce9f5096eb5cad67c342b40818b7e3ce9e4\n>\n> On one hand, these object ids won't mean much to anyone who might have\n> to debug such a test failure in the future, and on the other these\n> tests are about 'git format-patch', not about 'git rev-list'.  If the\n> check were written like this:\n>\n>   count=$(git rev-list --count master..side) &&\n>   ls patches >list &&\n>   test_line_count = $count list\n>\n> then the error message on failure would look something like this:\n>\n>   test_line_count: line count for list != 3\n>   0001-first.patch\n>   0002-second.patch\n>\n> which, I think, would be more useful.\n\nthanks for this detail. As I copied an existing test with this\npattern, I will add a new pre-patch to this serires which applies your\nidea to the existing test first, before I add new tests for this\npatch.\n\nBert\n\n>\n>\n> > +'\n> > +\n> > +test_expect_success 'format-patch -o with leading existing directories' '\n> > +     git format-patch -o patches/side master..side &&\n> > +     git rev-list master..side >list &&\n> > +     test_line_count = $(ls patches/side | wc -l) list\n> > +'\n> > +\n> > +test_expect_success 'format-patch -o with leading non-existing directories' '\n> > +     rm -fr patches &&\n> > +     git format-patch -o patches/side master..side &&\n> > +     git rev-list master..side >list &&\n> > +     test_line_count = $(ls patches/side | wc -l) list\n> > +'\n> > +\n> >  test_expect_success 'format-patch format.outputDirectory option' '\n> >       test_config format.outputDirectory patches &&\n> >       rm -fr patches &&\n> > --\n> > 2.23.0.11.g242cf7f110\n> >\n"},{"id":"383666","messageId":"30d03ed76e46a10bea883ba3fe85b186fbf31d25.1570526007.git.liu.denton@gmail.com","threadId":"51976","inReplyTo":"20191007210306.GF11529@szeder.dev","subject":"[PATCH] t4014: treat rev-list output as the expected value","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-08T09:14:11Z","receivedAt":"2019-10-08T09:14:17Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"In 6bd26f58ea (t4014: use test_line_count() where possible, 2019-08-27),\nwe converted many test cases to take advantage of the test_line_count()\nfunction. In one conversion, we inverted the expected and actual value\nas tested by test_line_count(). Although functionally correct, if\nformat-patch ever produced incorrect output, the debugging output would\nbe a bunch of hashes which would be difficult to debug.\n\nInvert the expected and actual values provided to test_line_count() so\nthat if format-patch produces incorrect output, the debugging output\nwill be a list of human-readable files instead.\n\nHelped-by: SZEDER Gábor <szeder.dev@gmail.com>\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\nThanks for point out my mistake, Szeder. This patch can be applied to\nthe tip of 'dl/format-patch-doc-test-cleanup' and then we should base\nBert's changes on top of this branch.\n\n t/t4014-format-patch.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 83f52614d3..72b09896cf 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -1610,8 +1610,9 @@ test_expect_success 'format-patch format.outputDirectory option' '\n \ttest_config format.outputDirectory patches &&\n \trm -fr patches &&\n \tgit format-patch master..side &&\n-\tgit rev-list master..side >list &&\n-\ttest_line_count = $(ls patches | wc -l) list\n+\tcount=$(git rev-list --count master..side) &&\n+\tls patches >list &&\n+\ttest_line_count = $count list\n '\n \n test_expect_success 'format-patch -o overrides format.outputDirectory' '\n-- \n2.23.0.248.g3a9dd8fb08\n\n"}]}