summaryrefslogtreecommitdiff
path: root/t/t7510-signed-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-01-05 10:54:14 -0800
committerJunio C Hamano <gitster@pobox.com>2012-01-05 13:02:26 -0800
commitc871a1d17b8433d98df59b03da5538f10c4ae52c (patch)
treece9d496f4015b0aa1ac08eca1f3c2e7357c725cb /t/t7510-signed-commit.sh
parente3f55e07076f88ec01a49dcfb7c2ac56658145a4 (diff)
downloadgit-c871a1d17b8433d98df59b03da5538f10c4ae52c.tar.gz
commit --amend -S: strip existing gpgsig headers
Any existing commit signature was made against the contents of the old commit, including its committer date that is about to change, and will become invalid by amending it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7510-signed-commit.sh')
-rwxr-xr-xt/t7510-signed-commit.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 30401ced07..1d3c56fe61 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -24,7 +24,8 @@ test_expect_success GPG 'create signed commits' '
echo 4 >file && test_tick && git commit -a -m "fourth unsigned" &&
git tag fourth-unsigned &&
- test_tick && git commit --amend -S -m "fourth signed"
+ test_tick && git commit --amend -S -m "fourth signed" &&
+ git tag fourth-signed
'
test_expect_success GPG 'show signatures' '
@@ -68,4 +69,12 @@ test_expect_success GPG 'detect fudged signature with NUL' '
! grep "Good signature from" actual2
'
+test_expect_success GPG 'amending already signed commit' '
+ git checkout fourth-signed^0 &&
+ git commit --amend -S --no-edit &&
+ git show -s --show-signature HEAD >actual &&
+ grep "Good signature from" actual &&
+ ! grep "BAD signature from" actual
+'
+
test_done