Re: [PATCH v2 2/2] tests: add test for separate author and committer idents

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 25 2019, William Hubbs wrote:

> Signed-off-by: William Hubbs <williamh@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxxx &&
> +	git config author.name author &&
> +	git config author.email author@xxxxxxxxxxx &&
> +	git config committer.name committer &&
> +	git config committer.email committer@xxxxxxxxxxx &&

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@xxxxxxxxxxx" ] &&
> +	[ "$(git log --format=%cn -1)" = "committer" ] &&
> +	[ "$(git log --format=%ce -1)" = "committer@xxxxxxxxxxx" ]

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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux