Imported Upstream version 2.22.2
[platform/upstream/git.git] / t / t7612-merge-verify-signatures.sh
index e797c74..d99218a 100755 (executable)
@@ -23,7 +23,7 @@ test_expect_success GPG 'create signed commits' '
        echo 3 >bar && git add bar &&
        test_tick && git commit -S -m "bad on side" &&
        git cat-file commit side-bad >raw &&
-       sed -e "s/bad/forged bad/" raw >forged &&
+       sed -e "s/^bad/forged bad/" raw >forged &&
        git hash-object -w -t commit forged >forged.commit &&
        git checkout initial &&
 
@@ -103,4 +103,11 @@ test_expect_success GPG 'merge commit with bad signature with merge.verifySignat
        git merge --no-verify-signatures $(cat forged.commit)
 '
 
+test_expect_success GPG 'merge unsigned commit into unborn branch' '
+       test_when_finished "git checkout initial" &&
+       git checkout --orphan unborn &&
+       test_must_fail git merge --verify-signatures side-unsigned 2>mergeerror &&
+       test_i18ngrep "does not have a GPG signature" mergeerror
+'
+
 test_done