git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: git@vger.kernel.org, Denton Liu <liu.denton@gmail.com>
Subject: Re: [PATCH v2 1/2] format-patch: create leading components of output directory
Date: Mon, 7 Oct 2019 23:03:06 +0200	[thread overview]
Message-ID: <20191007210306.GF11529@szeder.dev> (raw)
In-Reply-To: <2b8b000d76a20349f1f9e09260eff91429beebfb.1570264824.git.bert.wesarg@googlemail.com>

On Sat, Oct 05, 2019 at 10:43:51AM +0200, Bert Wesarg wrote:
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 83f52614d3..2f2cd6fea6 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -1606,6 +1606,26 @@ 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 &&
> +	git rev-list master..side >list &&
> +	test_line_count = $(ls patches | wc -l) list

This is sort of a nit...

So, these tests check that 'git rev-list ...' lists as many commits as
the number of files created by 'git format-patch'.  While it doesn't
affect the tests' correctness, this is subtly different from checking
that 'git format-patch' created as many files as the number of commits
listed by 'git rev-list'.

Consider how the tests' output would look like on failure:
'test_line_count' shows an error message that includes the content of
the file to be checked, which in this case would consist of a bunch of
commit object ids:

  test_line_count: line count for list != 3
  f7af51d27933a90554b6e9212a7e5d4ad1c74569
  bd89fce9f5096eb5cad67c342b40818b7e3ce9e4

On one hand, these object ids won't mean much to anyone who might have
to debug such a test failure in the future, and on the other these
tests are about 'git format-patch', not about 'git rev-list'.  If the
check were written like this:

  count=$(git rev-list --count master..side) &&
  ls patches >list &&
  test_line_count = $count list

then the error message on failure would look something like this:

  test_line_count: line count for list != 3
  0001-first.patch
  0002-second.patch

which, I think, would be more useful.


> +'
> +
> +test_expect_success 'format-patch -o with leading existing directories' '
> +	git format-patch -o patches/side master..side &&
> +	git rev-list master..side >list &&
> +	test_line_count = $(ls patches/side | wc -l) list
> +'
> +
> +test_expect_success 'format-patch -o with leading non-existing directories' '
> +	rm -fr patches &&
> +	git format-patch -o patches/side master..side &&
> +	git rev-list master..side >list &&
> +	test_line_count = $(ls patches/side | wc -l) list
> +'
> +
>  test_expect_success 'format-patch format.outputDirectory option' '
>  	test_config format.outputDirectory patches &&
>  	rm -fr patches &&
> -- 
> 2.23.0.11.g242cf7f110
> 

  parent reply	other threads:[~2019-10-07 21:03 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 [this message]
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 ` [PATCH 1/3] format-patch: document and exercise that -o does only create the trailing directory Denton Liu
2019-10-03 16:34   ` 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=20191007210306.GF11529@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    /path/to/YOUR_REPLY

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

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

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

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