git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: William Hubbs <williamh@gentoo.org>
Cc: git@vger.kernel.org, chutzpah@gentoo.org
Subject: Re: [PATCH v2 2/2] tests: add test for separate author and committer idents
Date: Sat, 26 Jan 2019 00:05:08 +0100	[thread overview]
Message-ID: <875zuc49uj.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20190125215955.30032-3-williamh@gentoo.org>


On Fri, Jan 25 2019, William Hubbs wrote:

> Signed-off-by: William Hubbs <williamh@gentoo.org>
> ---
>  t/t7517-per-repo-email.sh | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/t/t7517-per-repo-email.sh b/t/t7517-per-repo-email.sh
> index 231b8cc19d..06c7c0fb78 100755
> --- a/t/t7517-per-repo-email.sh
> +++ b/t/t7517-per-repo-email.sh
> @@ -85,4 +85,21 @@ test_expect_success REBASE_P \
>  	test_must_fail git rebase -p master
>  '

Let's include this in the main patch. We don't split up tests into their
own patches like this.

> +test_expect_success \
> +	'author and committer config settings override user config settings' '

This can just be on one line. We're not strict about 79 characters in
tests.

> +	sane_unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL &&
> +	sane_unset GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL &&

Fine, but FYI sets these variables for the rest of the test.

But more importantly there should be a test for how the various override
interactions between the config & env variables work. I.e. whether
GIT_COMMITTER_NAME set in the env will override "user.email" etc.

> +	git config user.name user &&
> +	git config user.email user@example.com &&
> +	git config author.name author &&
> +	git config author.email author@example.com &&
> +	git config committer.name committer &&
> +	git config committer.email committer@example.com &&

This should use "test_config" so it'll be unset after this test.

> +	test_commit config-names &&
> +	[ "$(git log --format=%an -1)" = "author" ] &&
> +	[ "$(git log --format=%ae -1)" = "author@example.com" ] &&
> +	[ "$(git log --format=%cn -1)" = "committer" ] &&
> +	[ "$(git log --format=%ce -1)" = "committer@example.com" ]

Should use something like test_cmp so that on failure we see what the
difference is. I'd just do:

    cat >expected <<EOF... &&
    git log --format="an:%an%nae:%ae[...]" -1 >actual &&
    test_cmp ...

> +'
> +
>  test_done

  reply	other threads:[~2019-01-25 23:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 21:59 Add author and committer configuration settings William Hubbs
2019-01-25 21:59 ` [PATCH v2 1/2] config: allow giving separate author and committer idents William Hubbs
2019-01-25 22:58   ` Ævar Arnfjörð Bjarmason
2019-01-28 18:58     ` William Hubbs
2019-01-28 19:00       ` Junio C Hamano
2019-01-28 20:04       ` Ævar Arnfjörð Bjarmason
2019-01-28 21:33         ` Junio C Hamano
2019-01-28 23:30         ` William Hubbs
2019-01-29 22:42     ` William Hubbs
2019-01-25 21:59 ` [PATCH v2 2/2] tests: add test for " William Hubbs
2019-01-25 23:05   ` Ævar Arnfjörð Bjarmason [this message]
2019-01-26  1:06     ` William Hubbs
2019-01-26  8:53       ` Ævar Arnfjörð Bjarmason
2019-01-27  4:48         ` Eric Sunshine
2019-01-28 19:05           ` Ævar Arnfjörð Bjarmason

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=875zuc49uj.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=chutzpah@gentoo.org \
    --cc=git@vger.kernel.org \
    --cc=williamh@gentoo.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).