From: Denton Liu <liu.denton@gmail.com>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] format-patch: document and exercise that -o does only create the trailing directory
Date: Wed, 2 Oct 2019 14:47:09 -0700 [thread overview]
Message-ID: <20191002214709.GA51809@generichostname> (raw)
In-Reply-To: <1aeacd8af4b83142f160c63be4746554e823cfc3.1570051490.git.bert.wesarg@googlemail.com>
Hi Bert,
> Subject: format-patch: document and exercise that -o does only create the trailing directory
s/does only create/only creates/ ?
Anyway, as a prepatory patch, I don't think that it's necessary. Maybe
it's just me but I assume that most tools create at most one directory
deep. Even mkdir won't created nested dirs unless you pass `-p`. I
dunno.
On Wed, Oct 02, 2019 at 11:26:11PM +0200, Bert Wesarg wrote:
> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
> ---
> Documentation/config/format.txt | 3 ++-
> Documentation/git-format-patch.txt | 4 +++-
> t/t4014-format-patch.sh | 16 ++++++++++++++++
> 3 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/config/format.txt b/Documentation/config/format.txt
> index 414a5a8a9d..e17c5d6b0f 100644
> --- a/Documentation/config/format.txt
> +++ b/Documentation/config/format.txt
> @@ -80,7 +80,8 @@ format.coverLetter::
>
> format.outputDirectory::
> Set a custom directory to store the resulting files instead of the
> - current working directory.
> + current working directory. Only the trailing directory will be created
> + though.
>
> format.useAutoBase::
> A boolean value which lets you enable the `--base=auto` option of
> diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
> index b9b97e63ae..fe7492353e 100644
> --- a/Documentation/git-format-patch.txt
> +++ b/Documentation/git-format-patch.txt
> @@ -66,7 +66,9 @@ they are created in the current working directory. The default path
> can be set with the `format.outputDirectory` configuration option.
> The `-o` option takes precedence over `format.outputDirectory`.
> To store patches in the current working directory even when
> -`format.outputDirectory` points elsewhere, use `-o .`.
> +`format.outputDirectory` points elsewhere, use `-o .`. Note that only
> +the trailing directory will be created by Git, leading directories must
> +already exists.
>
> By default, the subject of a single patch is "[PATCH] " followed by
> the concatenation of lines from the commit message up to the first blank
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index ca7debf1d4..bf2715a503 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -1632,6 +1632,22 @@ test_expect_success 'From line has expected format' '
> test_cmp from filtered
> '
>
> +test_expect_success 'format-patch -o with no leading directories' '
> + rm -fr patches &&
> + git format-patch -o patches master..side &&
> + test $(git rev-list master..side | wc -l) -eq $(ls patches | wc -l)
For test case you write, please use the following pattern:
git rev-list master..side >list &&
test_line_count = $(ls patches | wc -l) list
The first benefit is that we get to take advantage of the
test_line_count function that's already written for us. The second is
that when we write tests, we shouldn't put Git commands in the upstream
of a pipe because if they fail, their return codes will be lost and we
won't be able to fail the test properly.
> +'
> +
> +test_expect_success 'format-patch -o with leading existing directories' '
> + git format-patch -o patches/side master..side &&
> + test $(git rev-list master..side | wc -l) -eq $(ls patches/side | wc -l)
> +'
> +
> +test_expect_failure 'format-patch -o with leading non-existing directories' '
> + rm -fr patches &&
> + git format-patch -o patches/side master..side
> +'
As above, I wouldn't really call this a bug in Git. I think we should
leave this test case off until the next patch.
> +
> test_expect_success 'format-patch format.outputDirectory option' '
> test_config format.outputDirectory patches &&
> rm -fr patches &&
> --
> 2.23.0.11.g242cf7f110
>
next prev parent reply other threads:[~2019-10-02 21:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-02 21:26 [PATCH 1/3] format-patch: document and exercise that -o does only create the trailing directory Bert Wesarg
2019-10-02 21:26 ` [PATCH 2/3] format-patch: create output directory including leading components Bert Wesarg
2019-10-03 0:54 ` Junio C Hamano
2019-10-02 21:26 ` [RFC PATCH 3/3] format-patch: use a command to generate the output directory name Bert Wesarg
2019-10-03 0:57 ` Junio C Hamano
2019-10-05 8:43 ` [PATCH v2 1/2] format-patch: create leading components of output directory Bert Wesarg
2019-10-05 8:43 ` [PATCH v2 2/2] [RFC] format-patch: configure a command to generate the output directory name Bert Wesarg
2019-10-06 0:57 ` [PATCH v2 1/2] format-patch: create leading components of output directory Junio C Hamano
2019-10-07 21:03 ` SZEDER Gábor
2019-10-08 3:23 ` Junio C Hamano
2019-10-08 9:06 ` Bert Wesarg
2019-10-08 9:14 ` [PATCH] t4014: treat rev-list output as the expected value Denton Liu
2019-10-02 21:47 ` Denton Liu [this message]
2019-10-03 16:34 ` [PATCH 1/3] format-patch: document and exercise that -o does only create the trailing directory Bert Wesarg
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=20191002214709.GA51809@generichostname \
--to=liu.denton@gmail.com \
--cc=bert.wesarg@googlemail.com \
--cc=git@vger.kernel.org \
/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).