Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: git@vger.kernel.org, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH 2/5] name-rev: extend --refs to accept multiple patterns
Date: Thu, 12 Jan 2017 10:56:12 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1701121049530.3469@virtualbox> (raw)
In-Reply-To: <20170112001721.2534-3-jacob.e.keller@intel.com>

Hi Jake,

On Wed, 11 Jan 2017, Jacob Keller wrote:

> diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
> index 1408b608eb03..d072ec43b016 100755
> --- a/t/t6007-rev-list-cherry-pick-file.sh
> +++ b/t/t6007-rev-list-cherry-pick-file.sh
> @@ -99,6 +99,36 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
>  	test_cmp actual.named expect
>  '
>  
> +test_expect_success 'name-rev multiple --refs combine inclusive' '
> +	git rev-list --left-right --cherry-pick F...E -- bar > actual &&

Our current coding style seems to skip the space between `>` and `actual`
(this applies to all redirections added in this patch).

> +	git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
> +		< actual > actual.named &&
> +	test_cmp actual.named expect
> +'
> +
> +cat >expect <<EOF
> +<tags/F
> +$(git rev-list --left-right --right-only --cherry-pick F...E -- bar)
> +EOF

In the current revision of t6007, we seem to list the expected output
explicitly, i.e. *not* generating it dynamically.

If you *do* insist to generate the `expect` file dynamically, a better way
would be to include that generation in the `test_expect_success` code so
that errors in the call can be caught, too:

test_expect_success 'name-rev --refs excludes non-matched patterns' '
	echo "<tags/F" >expect &&
	git rev-list --left-right --right-only --cherry-pick F...E -- \
		bar >>expect &&
	[...]

However, if I was asked for my preference, I would suggest to specify the
`expect` contents explicitly, to document the expectation as of time of
writing. The reason: I debugged my share of test breakages and these
dynamically-generated `expect` files are the worst. When things break, you
have to dig *real* deep to figure out what is going wrong, as sometimes
the *generation of the `expect` file* regresses.

Ciao,
Dscho

  reply	other threads:[~2017-01-12  9:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  0:17 [PATCH 0/5] extend git-describe pattern matching Jacob Keller
2017-01-12  0:17 ` [PATCH 1/5] doc: add documentation for OPT_STRING_LIST Jacob Keller
2017-01-12  9:47   ` Johannes Schindelin
2017-01-13  0:51     ` Jacob Keller
2017-01-12  0:17 ` [PATCH 2/5] name-rev: extend --refs to accept multiple patterns Jacob Keller
2017-01-12  9:56   ` Johannes Schindelin [this message]
2017-01-13  0:56     ` Jacob Keller
2017-01-12  0:17 ` [PATCH 3/5] name-rev: add support to discard refs by pattern match Jacob Keller
2017-01-12  9:57   ` Johannes Schindelin
2017-01-13  0:56     ` Jacob Keller
2017-01-12  0:17 ` [PATCH 4/5] describe: teach --match to accept multiple patterns Jacob Keller
2017-01-12  0:17 ` [PATCH 5/5] describe: teach describe negative pattern matches Jacob Keller
2017-01-12  9:42   ` Johannes Schindelin
2017-01-12 22:02     ` Junio C Hamano
2017-01-12 13:45   ` Johannes Sixt
2017-01-13  0:59     ` Jacob Keller
2017-01-13  6:43       ` Johannes Sixt
2017-01-13  6:57         ` Jacob Keller
2017-01-13 21:31           ` Johannes Sixt
2017-01-17 23:31             ` Jacob Keller
2017-01-18 12:44               ` Johannes Schindelin
2017-01-18 21:04                 ` Jacob Keller
2017-01-12 10:05 ` [PATCH 0/5] extend git-describe pattern matching Johannes Schindelin
2017-01-13 18:48 ` Junio C Hamano
2017-01-13 20:41   ` Jacob Keller

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1701121049530.3469@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jacob.keller@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox