ssh signing: make sign/amend test more resilient

The test `amending already signed commit` is using git checkout to select a specific commit to amend. In case an earlier test fails and leaves behind a dirty index/worktree this test would fail as well. Using `checkout -f` will avoid interference by most other tests. Signed-off-by: Fabian Stelzer <fs@gigacodes.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fabian Stelzer committed Nov 19, 2021 at 16:07 UTC 3b4b5a793a36d1e92114ff929eb7d15d55d45a96
2 files changed +2 -2
t/t7510-signed-commit.sh
+1 -1
@@ -228,7 +228,7 @@ test_expect_success GPG 'detect fudged signature with NUL' '
228 '
229
230 test_expect_success GPG 'amending already signed commit' '
231 - git checkout fourth-signed^0 &&
231 + git checkout -f fourth-signed^0 &&
232 git commit --amend -S --no-edit &&
233 git verify-commit HEAD &&
234 git show -s --show-signature HEAD >actual &&
t/t7528-signed-commit-ssh.sh
+1 -1
@@ -239,7 +239,7 @@ test_expect_success GPGSSH 'amending already signed commit' '
239 test_config gpg.format ssh &&
240 test_config user.signingkey "${GPGSSH_KEY_PRIMARY}" &&
241 test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" &&
242 - git checkout fourth-signed^0 &&
242 + git checkout -f fourth-signed^0 &&
243 git commit --amend -S --no-edit &&
244 git verify-commit HEAD &&
245 git show -s --show-signature HEAD >actual &&