commit-reach(get_octopus_merge_bases): pass on "missing commits" errors
[git.git] / t / t5404-tracking-branches.sh
blob51737eeafeeefa0c1b1f075081f4c5c4b95de64e
1 #!/bin/sh
3 test_description='tracking branch update checks for git push'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
11 test_expect_success 'setup' '
12 echo 1 >file &&
13 git add file &&
14 git commit -m 1 &&
15 git branch b1 &&
16 git branch b2 &&
17 git branch b3 &&
18 git clone . aa &&
19 git checkout b1 &&
20 echo b1 >>file &&
21 git commit -a -m b1 &&
22 git checkout b2 &&
23 echo b2 >>file &&
24 git commit -a -m b2
27 test_expect_success 'prepare pushable branches' '
28 cd aa &&
29 b1=$(git rev-parse origin/b1) &&
30 b2=$(git rev-parse origin/b2) &&
31 git checkout -b b1 origin/b1 &&
32 echo aa-b1 >>file &&
33 git commit -a -m aa-b1 &&
34 git checkout -b b2 origin/b2 &&
35 echo aa-b2 >>file &&
36 git commit -a -m aa-b2 &&
37 git checkout main &&
38 echo aa-main >>file &&
39 git commit -a -m aa-main
42 test_expect_success 'mixed-success push returns error' '
43 test_must_fail git push origin :
46 test_expect_success 'check tracking branches updated correctly after push' '
47 test "$(git rev-parse origin/main)" = "$(git rev-parse main)"
50 test_expect_success 'check tracking branches not updated for failed refs' '
51 test "$(git rev-parse origin/b1)" = "$b1" &&
52 test "$(git rev-parse origin/b2)" = "$b2"
55 test_expect_success 'deleted branches have their tracking branches removed' '
56 git push origin :b1 &&
57 test "$(git rev-parse origin/b1)" = "origin/b1"
60 test_expect_success 'already deleted tracking branches ignored' '
61 git branch -d -r origin/b3 &&
62 git push origin :b3 >output 2>&1 &&
63 ! grep "^error: " output
66 test_done