# [PATCH] commit --amend: test specifies authorship but forgets to check

2 messages from 2014-07-30 to 2014-07-30. Participants: Fabian Ruch, Junio C Hamano.
Thread: https://gitlist.dev/t/37245

## Fabian Ruch, 2014-07-30 09:45

Subject: [PATCH] commit --amend: test specifies authorship but forgets to check
Message-ID: <0ba2fcaf784bb74ee5a9f8d13dce64ab09e66d7b.1406713446.git.bafain@gmail.com>
URL: https://gitlist.dev/e/0ba2fcaf784bb74ee5a9f8d13dce64ab09e66d7b.1406713446.git.bafain%40gmail.com

```
The test case "--amend option copies authorship" specifies that the
git-commit option `--amend` uses the authorship of the replaced
commit for the new commit. Add the omitted check that this property
actually holds.

Signed-off-by: Fabian Ruch <bafain@gmail.com>
---
Without the check, the test case succeeds even with nonsense in the
`expected` file. An `--amend` implementation which simply uses the
committer name and date as if it was not amending would have been
deemed correct. This is not the case, the implementation still passes
the test suite after the correction.

Quickly skimming over the rest of the file, I couldn't find the same
thing twice.

 t/t7509-commit.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/t7509-commit.sh b/t/t7509-commit.sh
index b61fd3c..9ac7940 100755
--- a/t/t7509-commit.sh
+++ b/t/t7509-commit.sh
@@ -77,6 +77,7 @@ test_expect_success '--amend option copies authorship' '
 	git commit -a --amend -m "amend test" &&
 	author_header Initial >expect &&
 	author_header HEAD >actual &&
+	test_cmp expect actual &&
 
 	echo "amend test" >expect &&
 	message_body HEAD >actual &&
-- 
2.0.1

```

## Junio C Hamano, 2014-07-30 19:44

Subject: Re: [PATCH] commit --amend: test specifies authorship but forgets to check
Message-ID: <xmqqppgmy6ld.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqppgmy6ld.fsf%40gitster.dls.corp.google.com
In-Reply-To: <0ba2fcaf784bb74ee5a9f8d13dce64ab09e66d7b.1406713446.git.bafain@gmail.com>

```
Fabian Ruch <bafain@gmail.com> writes:

> The test case "--amend option copies authorship" specifies that the
> git-commit option `--amend` uses the authorship of the replaced
> commit for the new commit. Add the omitted check that this property
> actually holds.
>
> Signed-off-by: Fabian Ruch <bafain@gmail.com>
> ---
> Without the check, the test case succeeds even with nonsense in the
> `expected` file. An `--amend` implementation which simply uses the
> committer name and date as if it was not amending would have been
> deemed correct. This is not the case, the implementation still passes
> the test suite after the correction.
>
> Quickly skimming over the rest of the file, I couldn't find the same
> thing twice.
>
>  t/t7509-commit.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/t/t7509-commit.sh b/t/t7509-commit.sh
> index b61fd3c..9ac7940 100755
> --- a/t/t7509-commit.sh
> +++ b/t/t7509-commit.sh
> @@ -77,6 +77,7 @@ test_expect_success '--amend option copies authorship' '
>  	git commit -a --amend -m "amend test" &&
>  	author_header Initial >expect &&
>  	author_header HEAD >actual &&
> +	test_cmp expect actual &&
>  
>  	echo "amend test" >expect &&
>  	message_body HEAD >actual &&

Makes sense; thanks.

```
