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-0001-standard-git-push--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-0001-standard-git-push--porcelain.sh` 138 lines ยท 4874 bytes Raw Blame History 1 # Refs of upstream : main(A) 2 # Refs of workbench: main(A) tags/v123 3 # git-push : main(B) next(A) 4 test_expect_success "git-push ($PROTOCOL/porcelain)" ' 5 git -C workbench push --porcelain origin \ 6 $B:refs/heads/main \ 7 HEAD:refs/heads/next \ 8 >out 2>&1 && 9 make_user_friendly_and_stable_output actual && 10 format_and_save_expect <<-EOF && 11 > remote: # pre-receive hook Z 12 > remote: pre-receive< refs/heads/main Z 13 > remote: pre-receive< refs/heads/next Z 14 > remote: # post-receive hook Z 15 > remote: post-receive< refs/heads/main Z 16 > remote: post-receive< refs/heads/next Z 17 > To 18 > :refs/heads/main .. 19 > * HEAD:refs/heads/next [new branch] 20 > Done 21 EOF 22 test_cmp expect actual && 23 24 test_cmp_refs -C "$upstream" <<-EOF 25 refs/heads/main 26 refs/heads/next 27 EOF 28 ' 29 30 # Refs of upstream : main(B) next(A) 31 # Refs of workbench: main(A) tags/v123 32 # git-push --atomic: main(A) next(B) 33 test_expect_success "git-push --atomic ($PROTOCOL/porcelain)" ' 34 test_must_fail git -C workbench push --atomic --porcelain origin \ 35 main \ 36 $B:refs/heads/next \ 37 >out-$test_count 2>&1 && 38 filter_out_user_friendly_and_stable_output \ 39 -e "s/^# GETTEXT POISON #//" \ 40 -e "/^To / { p; }" \ 41 -e "/^!/ { p; }" \ 42 actual && 43 format_and_save_expect <<-EOF && 44 > To 45 > ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward) 46 > ! :refs/heads/next [rejected] (atomic push failed) 47 EOF 48 test_cmp expect actual && 49 50 test_cmp_refs -C "$upstream" <<-EOF 51 refs/heads/main 52 refs/heads/next 53 EOF 54 ' 55 56 # Refs of upstream : main(B) next(A) 57 # Refs of workbench: main(A) tags/v123 58 # git-push : main(A) next(B) 59 test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" ' 60 test_must_fail git \ 61 -C workbench \ 62 -c advice.pushUpdateRejected=false \ 63 push --porcelain origin \ 64 main \ 65 $B:refs/heads/next \ 66 >out-$test_count 2>&1 && 67 make_user_friendly_and_stable_output actual && 68 format_and_save_expect <<-EOF && 69 > remote: # pre-receive hook Z 70 > remote: pre-receive< refs/heads/next Z 71 > remote: # post-receive hook Z 72 > remote: post-receive< refs/heads/next Z 73 > To 74 > :refs/heads/next .. 75 > ! refs/heads/main:refs/heads/main [rejected] (non-fast-forward) 76 > Done 77 EOF 78 test_cmp expect actual && 79 80 test_cmp_refs -C "$upstream" <<-EOF 81 refs/heads/main 82 refs/heads/next 83 EOF 84 ' 85 86 # Refs of upstream : main(B) next(B) 87 # Refs of workbench: main(A) tags/v123 88 # git-push -f : main(A) NULL tags/v123 refs/review/main/topic(A) a/b/c(A) 89 test_expect_success "git-push -f ($PROTOCOL/porcelain)" ' 90 git -C workbench push --porcelain -f origin \ 91 refs/tags/v123 \ 92 :refs/heads/next \ 93 main \ 94 main:refs/review/main/topic \ 95 HEAD:refs/heads/a/b/c \ 96 >out 2>&1 && 97 make_user_friendly_and_stable_output actual && 98 format_and_save_expect <<-EOF && 99 > remote: # pre-receive hook Z 100 > remote: pre-receive< refs/heads/main Z 101 > remote: pre-receive< refs/heads/next Z 102 > remote: pre-receive< refs/tags/v123 Z 103 > remote: pre-receive< refs/review/main/topic Z 104 > remote: pre-receive< refs/heads/a/b/c Z 105 > remote: # post-receive hook Z 106 > remote: post-receive< refs/heads/main Z 107 > remote: post-receive< refs/heads/next Z 108 > remote: post-receive< refs/tags/v123 Z 109 > remote: post-receive< refs/review/main/topic Z 110 > remote: post-receive< refs/heads/a/b/c Z 111 > To 112 > + refs/heads/main:refs/heads/main ... (forced update) 113 > - :refs/heads/next [deleted] 114 > * refs/tags/v123:refs/tags/v123 [new tag] 115 > * refs/heads/main:refs/review/main/topic [new reference] 116 > * HEAD:refs/heads/a/b/c [new branch] 117 > Done 118 EOF 119 test_cmp expect actual && 120 121 test_cmp_refs -C "$upstream" <<-EOF 122 refs/heads/a/b/c 123 refs/heads/main 124 refs/review/main/topic 125 refs/tags/v123 126 EOF 127 ' 128 129 # Refs of upstream : main(A) tags/v123 refs/review/main/topic(A) a/b/c(A) 130 # Refs of workbench: main(A) tags/v123 131 test_expect_success "cleanup ($PROTOCOL/porcelain)" ' 132 ( 133 cd "$upstream" && 134 git update-ref -d refs/review/main/topic && 135 git update-ref -d refs/tags/v123 && 136 git update-ref -d refs/heads/a/b/c 137 ) 138 '