3 # Copyright (c) 2020 Doan Tran Cong Danh
6 test_description
='test {cherry-pick,revert} --[no-]gpg-sign'
8 TEST_PASSES_SANITIZE_LEAK
=true
10 .
"$TEST_DIRECTORY/lib-gpg.sh"
12 if ! test_have_prereq GPG
14 skip_all
='skip all test {cherry-pick,revert} --[no-]gpg-sign, gpg not available'
19 local must_fail
= will
=will fake_editor
=
22 must_fail
=test_must_fail
30 test_expect_success
"$cmd $* $cmit with commit.gpgsign=$conf $will sign commit" "
31 git reset --hard tip &&
32 git config commit.gpgsign $conf &&
34 git rev-list tip.. >rev-list &&
35 $must_fail git verify-commit \$(cat rev-list)
39 test_expect_success
'setup' '
50 test_gpg_sign
! false cherry-pick side
51 test_gpg_sign
! false cherry-pick ..side
52 test_gpg_sign true cherry-pick side
53 test_gpg_sign true cherry-pick ..side
54 test_gpg_sign
! true cherry-pick side
--no-gpg-sign
55 test_gpg_sign
! true cherry-pick ..side
--no-gpg-sign
56 test_gpg_sign
! true cherry-pick side
--gpg-sign --no-gpg-sign
57 test_gpg_sign
! true cherry-pick ..side
--gpg-sign --no-gpg-sign
58 test_gpg_sign false cherry-pick side
--no-gpg-sign --gpg-sign
59 test_gpg_sign false cherry-pick ..side
--no-gpg-sign --gpg-sign
60 test_gpg_sign true cherry-pick side
--edit
61 test_gpg_sign true cherry-pick ..side
--edit
62 test_gpg_sign
! true cherry-pick side
--edit --no-gpg-sign
63 test_gpg_sign
! true cherry-pick ..side
--edit --no-gpg-sign
64 test_gpg_sign
! true cherry-pick side
--edit --gpg-sign --no-gpg-sign
65 test_gpg_sign
! true cherry-pick ..side
--edit --gpg-sign --no-gpg-sign
66 test_gpg_sign false cherry-pick side
--edit --no-gpg-sign --gpg-sign
67 test_gpg_sign false cherry-pick ..side
--edit --no-gpg-sign --gpg-sign
69 test_gpg_sign
! false revert HEAD
--edit
70 test_gpg_sign
! false revert two..
--edit
71 test_gpg_sign true revert HEAD
--edit
72 test_gpg_sign true revert two..
--edit
73 test_gpg_sign
! true revert HEAD
--edit --no-gpg-sign
74 test_gpg_sign
! true revert two..
--edit --no-gpg-sign
75 test_gpg_sign
! true revert HEAD
--edit --gpg-sign --no-gpg-sign
76 test_gpg_sign
! true revert two..
--edit --gpg-sign --no-gpg-sign
77 test_gpg_sign false revert HEAD
--edit --no-gpg-sign --gpg-sign
78 test_gpg_sign false revert two..
--edit --no-gpg-sign --gpg-sign
79 test_gpg_sign true revert HEAD
--no-edit
80 test_gpg_sign true revert two..
--no-edit
81 test_gpg_sign
! true revert HEAD
--no-edit --no-gpg-sign
82 test_gpg_sign
! true revert two..
--no-edit --no-gpg-sign
83 test_gpg_sign
! true revert HEAD
--no-edit --gpg-sign --no-gpg-sign
84 test_gpg_sign
! true revert two..
--no-edit --gpg-sign --no-gpg-sign
85 test_gpg_sign false revert HEAD
--no-edit --no-gpg-sign --gpg-sign