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/t5411/test-0027-push-options--porcelain.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 / t5411 / test-0027-push-options--porcelain.sh` 138 lines ยท 4659 bytes Raw Blame History 1 test_expect_success "setup proc-receive hook and disable push-options ($PROTOCOL/porcelain)" ' 2 git -C "$upstream" config receive.advertisePushOptions false && 3 test_hook -C "$upstream" --clobber proc-receive <<-\EOF 4 printf >&2 "# proc-receive hook\n" 5 test-tool proc-receive -v \ 6 -r "ok refs/for/main/topic" 7 EOF 8 ' 9 10 # Refs of upstream : main(A) 11 # Refs of workbench: main(A) tags/v123 12 # git push -o ... : refs/for/main/topic 13 test_expect_success "proc-receive: not support push options ($PROTOCOL/porcelain)" ' 14 test_must_fail git -C workbench push \ 15 --porcelain \ 16 -o issue=123 \ 17 -o reviewer=user1 \ 18 origin \ 19 HEAD:refs/for/main/topic \ 20 >out-$test_count 2>&1 && 21 make_user_friendly_and_stable_output actual && 22 test_grep "fatal: the receiving end does not support push options" \ 23 actual && 24 25 test_cmp_refs -C "$upstream" <<-EOF 26 refs/heads/main 27 EOF 28 ' 29 30 test_expect_success "enable push options ($PROTOCOL/porcelain)" ' 31 git -C "$upstream" config receive.advertisePushOptions true 32 ' 33 34 test_expect_success "setup version=0 for proc-receive hook ($PROTOCOL/porcelain)" ' 35 test_hook -C "$upstream" --clobber proc-receive <<-\EOF 36 printf >&2 "# proc-receive hook\n" 37 test-tool proc-receive -v \ 38 --version 0 \ 39 -r "ok refs/for/main/topic" 40 EOF 41 ' 42 43 # Refs of upstream : main(A) 44 # Refs of workbench: main(A) tags/v123 45 # git push -o ... : next(A) refs/for/main/topic 46 test_expect_success "proc-receive: ignore push-options for version 0 ($PROTOCOL/porcelain)" ' 47 git -C workbench push \ 48 --porcelain \ 49 --atomic \ 50 -o issue=123 \ 51 -o reviewer=user1 \ 52 origin \ 53 HEAD:refs/heads/next \ 54 HEAD:refs/for/main/topic \ 55 >out 2>&1 && 56 make_user_friendly_and_stable_output actual && 57 format_and_save_expect <<-EOF && 58 > remote: # pre-receive hook Z 59 > remote: pre-receive< refs/heads/next Z 60 > remote: pre-receive< refs/for/main/topic Z 61 > remote: # proc-receive hook Z 62 > remote: proc-receive< refs/for/main/topic Z 63 > remote: proc-receive> ok refs/for/main/topic Z 64 > remote: # post-receive hook Z 65 > remote: post-receive< refs/heads/next Z 66 > remote: post-receive< refs/for/main/topic Z 67 > To 68 > * HEAD:refs/heads/next [new branch] 69 > * HEAD:refs/for/main/topic [new reference] 70 > Done 71 EOF 72 test_cmp expect actual && 73 74 test_cmp_refs -C "$upstream" <<-EOF 75 refs/heads/main 76 refs/heads/next 77 EOF 78 ' 79 80 test_expect_success "restore proc-receive hook ($PROTOCOL/porcelain)" ' 81 test_hook -C "$upstream" --clobber proc-receive <<-\EOF 82 printf >&2 "# proc-receive hook\n" 83 test-tool proc-receive -v \ 84 -r "ok refs/for/main/topic" 85 EOF 86 ' 87 88 # Refs of upstream : main(A) next(A) 89 # Refs of workbench: main(A) tags/v123 90 test_expect_success "cleanup ($PROTOCOL/porcelain)" ' 91 git -C "$upstream" update-ref -d refs/heads/next 92 ' 93 94 # Refs of upstream : main(A) 95 # Refs of workbench: main(A) tags/v123 96 # git push -o ... : next(A) refs/for/main/topic 97 test_expect_success "proc-receive: push with options ($PROTOCOL/porcelain)" ' 98 git -C workbench push \ 99 --porcelain \ 100 --atomic \ 101 -o issue=123 \ 102 -o reviewer=user1 \ 103 origin \ 104 HEAD:refs/heads/next \ 105 HEAD:refs/for/main/topic \ 106 >out 2>&1 && 107 make_user_friendly_and_stable_output actual && 108 format_and_save_expect <<-EOF && 109 > remote: # pre-receive hook Z 110 > remote: pre-receive< refs/heads/next Z 111 > remote: pre-receive< refs/for/main/topic Z 112 > remote: # proc-receive hook Z 113 > remote: proc-receive: atomic push_options Z 114 > remote: proc-receive< refs/for/main/topic Z 115 > remote: proc-receive< issue=123 Z 116 > remote: proc-receive< reviewer=user1 Z 117 > remote: proc-receive> ok refs/for/main/topic Z 118 > remote: # post-receive hook Z 119 > remote: post-receive< refs/heads/next Z 120 > remote: post-receive< refs/for/main/topic Z 121 > To 122 > * HEAD:refs/heads/next [new branch] 123 > * HEAD:refs/for/main/topic [new reference] 124 > Done 125 EOF 126 test_cmp expect actual && 127 128 test_cmp_refs -C "$upstream" <<-EOF 129 refs/heads/main 130 refs/heads/next 131 EOF 132 ' 133 134 # Refs of upstream : main(A) next(A) 135 # Refs of workbench: main(A) tags/v123 136 test_expect_success "cleanup ($PROTOCOL/porcelain)" ' 137 git -C "$upstream" update-ref -d refs/heads/next 138 '