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