]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3514-cherry-pick-revert-gpg.sh
Merge branch 'pb/ref-filter-with-crlf'
[thirdparty/git.git] / t / t3514-cherry-pick-revert-gpg.sh
CommitLineData
cf0ad4d1
ĐTCD
1#!/bin/sh
2#
3# Copyright (c) 2020 Doan Tran Cong Danh
4#
5
6test_description='test {cherry-pick,revert} --[no-]gpg-sign'
7
8. ./test-lib.sh
9. "$TEST_DIRECTORY/lib-gpg.sh"
10
11if ! test_have_prereq GPG
12then
13 skip_all='skip all test {cherry-pick,revert} --[no-]gpg-sign, gpg not available'
14 test_done
15fi
16
17test_gpg_sign () {
18 local must_fail= will=will fake_editor=
19 if test "x$1" = "x!"
20 then
21 must_fail=test_must_fail
22 will="won't"
23 shift
24 fi
25 conf=$1
26 cmd=$2
27 cmit=$3
28 shift 3
29 test_expect_success "$cmd $* $cmit with commit.gpgsign=$conf $will sign commit" "
30 git reset --hard tip &&
31 git config commit.gpgsign $conf &&
32 git $cmd $* $cmit &&
33 git rev-list tip.. >rev-list &&
34 $must_fail git verify-commit \$(cat rev-list)
35 "
36}
37
38test_expect_success 'setup' '
39 test_commit one &&
40 git switch -c side &&
41 test_commit side1 &&
42 test_commit side2 &&
43 git switch - &&
44 test_commit two &&
45 test_commit three &&
46 test_commit tip
47'
48
49test_gpg_sign ! false cherry-pick side
50test_gpg_sign ! false cherry-pick ..side
51test_gpg_sign true cherry-pick side
52test_gpg_sign true cherry-pick ..side
53test_gpg_sign ! true cherry-pick side --no-gpg-sign
54test_gpg_sign ! true cherry-pick ..side --no-gpg-sign
55test_gpg_sign ! true cherry-pick side --gpg-sign --no-gpg-sign
56test_gpg_sign ! true cherry-pick ..side --gpg-sign --no-gpg-sign
57test_gpg_sign false cherry-pick side --no-gpg-sign --gpg-sign
58test_gpg_sign false cherry-pick ..side --no-gpg-sign --gpg-sign
59test_gpg_sign true cherry-pick side --edit
60test_gpg_sign true cherry-pick ..side --edit
61test_gpg_sign ! true cherry-pick side --edit --no-gpg-sign
62test_gpg_sign ! true cherry-pick ..side --edit --no-gpg-sign
63test_gpg_sign ! true cherry-pick side --edit --gpg-sign --no-gpg-sign
64test_gpg_sign ! true cherry-pick ..side --edit --gpg-sign --no-gpg-sign
65test_gpg_sign false cherry-pick side --edit --no-gpg-sign --gpg-sign
66test_gpg_sign false cherry-pick ..side --edit --no-gpg-sign --gpg-sign
67
68test_gpg_sign ! false revert HEAD --edit
69test_gpg_sign ! false revert two.. --edit
70test_gpg_sign true revert HEAD --edit
71test_gpg_sign true revert two.. --edit
72test_gpg_sign ! true revert HEAD --edit --no-gpg-sign
73test_gpg_sign ! true revert two.. --edit --no-gpg-sign
74test_gpg_sign ! true revert HEAD --edit --gpg-sign --no-gpg-sign
75test_gpg_sign ! true revert two.. --edit --gpg-sign --no-gpg-sign
76test_gpg_sign false revert HEAD --edit --no-gpg-sign --gpg-sign
77test_gpg_sign false revert two.. --edit --no-gpg-sign --gpg-sign
78test_gpg_sign true revert HEAD --no-edit
79test_gpg_sign true revert two.. --no-edit
80test_gpg_sign ! true revert HEAD --no-edit --no-gpg-sign
81test_gpg_sign ! true revert two.. --no-edit --no-gpg-sign
82test_gpg_sign ! true revert HEAD --no-edit --gpg-sign --no-gpg-sign
83test_gpg_sign ! true revert two.. --no-edit --gpg-sign --no-gpg-sign
84test_gpg_sign false revert HEAD --no-edit --no-gpg-sign --gpg-sign
85
86test_done