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