Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t3435-rebase-gpg-sign.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t3435-rebase-gpg-sign.sh` 123 lines ยท 3359 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2020 Doan Tran Cong Danh 4 # 5 6 test_description='test rebase --[no-]gpg-sign' 7 8 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 10 11 . ./test-lib.sh 12 . "$TEST_DIRECTORY/lib-rebase.sh" 13 . "$TEST_DIRECTORY/lib-gpg.sh" 14 15 if ! test_have_prereq GPG 16 then 17 skip_all='skip all test rebase --[no-]gpg-sign, gpg not available' 18 test_done 19 fi 20 21 test_rebase_gpg_sign () { 22 local must_fail= will=will fake_editor= 23 if test "x$1" = "x!" 24 then 25 must_fail=test_must_fail 26 will="won't" 27 shift 28 fi 29 conf=$1 30 shift 31 test_expect_success "rebase $* with commit.gpgsign=$conf $will sign commit" " 32 git reset two && 33 git config commit.gpgsign $conf && 34 set_fake_editor && 35 FAKE_LINES='r 1 p 2' git rebase --force-rebase --root $* && 36 $must_fail git verify-commit HEAD^ && 37 $must_fail git verify-commit HEAD 38 " 39 } 40 41 test_expect_success 'setup' ' 42 test_commit one && 43 test_commit two && 44 test_must_fail git verify-commit HEAD && 45 test_must_fail git verify-commit HEAD^ 46 ' 47 48 test_expect_success 'setup: merge commit' ' 49 test_commit fork-point && 50 git switch -c side && 51 test_commit three && 52 git switch main && 53 git merge --no-ff side && 54 git tag merged 55 ' 56 57 test_rebase_gpg_sign ! false 58 test_rebase_gpg_sign true 59 test_rebase_gpg_sign ! true --no-gpg-sign 60 test_rebase_gpg_sign ! true --gpg-sign --no-gpg-sign 61 test_rebase_gpg_sign false --no-gpg-sign --gpg-sign 62 test_rebase_gpg_sign true -i 63 test_rebase_gpg_sign ! true -i --no-gpg-sign 64 test_rebase_gpg_sign ! true -i --gpg-sign --no-gpg-sign 65 test_rebase_gpg_sign false -i --no-gpg-sign --gpg-sign 66 67 test_expect_success 'rebase -r, merge strategy, --gpg-sign will sign commit' ' 68 git reset --hard merged && 69 test_unconfig commit.gpgsign && 70 git rebase -fr --gpg-sign -s resolve --root && 71 git verify-commit HEAD 72 ' 73 74 test_expect_success 'rebase -r, merge strategy, commit.gpgsign=true will sign commit' ' 75 git reset --hard merged && 76 git config commit.gpgsign true && 77 git rebase -fr -s resolve --root && 78 git verify-commit HEAD 79 ' 80 81 test_expect_success 'rebase -r, merge strategy, commit.gpgsign=false --gpg-sign will sign commit' ' 82 git reset --hard merged && 83 git config commit.gpgsign false && 84 git rebase -fr --gpg-sign -s resolve --root && 85 git verify-commit HEAD 86 ' 87 88 test_expect_success "rebase -r, merge strategy, commit.gpgsign=true --no-gpg-sign won't sign commit" ' 89 git reset --hard merged && 90 git config commit.gpgsign true && 91 git rebase -fr --no-gpg-sign -s resolve --root && 92 test_must_fail git verify-commit HEAD 93 ' 94 95 test_expect_success 'rebase -r --gpg-sign will sign commit' ' 96 git reset --hard merged && 97 test_unconfig commit.gpgsign && 98 git rebase -fr --gpg-sign --root && 99 git verify-commit HEAD 100 ' 101 102 test_expect_success 'rebase -r with commit.gpgsign=true will sign commit' ' 103 git reset --hard merged && 104 git config commit.gpgsign true && 105 git rebase -fr --root && 106 git verify-commit HEAD 107 ' 108 109 test_expect_success 'rebase -r --gpg-sign with commit.gpgsign=false will sign commit' ' 110 git reset --hard merged && 111 git config commit.gpgsign false && 112 git rebase -fr --gpg-sign --root && 113 git verify-commit HEAD 114 ' 115 116 test_expect_success "rebase -r --no-gpg-sign with commit.gpgsign=true won't sign commit" ' 117 git reset --hard merged && 118 git config commit.gpgsign true && 119 git rebase -fr --no-gpg-sign --root && 120 test_must_fail git verify-commit HEAD 121 ' 122 123 test_done