On Fri, Jan 25 2019, William Hubbs wrote:

> Signed-off-by: William Hubbs <willi...@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 u...@example.com &&
> +     git config author.name author &&
> +     git config author.email aut...@example.com &&
> +     git config committer.name committer &&
> +     git config committer.email commit...@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)" = "aut...@example.com" ] &&
> +     [ "$(git log --format=%cn -1)" = "committer" ] &&
> +     [ "$(git log --format=%ce -1)" = "commit...@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 via email to