]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5404-tracking-branches.sh
t/test-lib.sh: exit with small negagive int is ok with test_must_fail
[thirdparty/git.git] / t / t5404-tracking-branches.sh
CommitLineData
6fa92bf3
AR
1#!/bin/sh
2
3test_description='tracking branch update checks for git push'
4
5. ./test-lib.sh
6
7test_expect_success 'setup' '
8 echo 1 >file &&
9 git add file &&
10 git commit -m 1 &&
11 git branch b1 &&
12 git branch b2 &&
0b294c0a 13 git branch b3 &&
6fa92bf3
AR
14 git clone . aa &&
15 git checkout b1 &&
16 echo b1 >>file &&
17 git commit -a -m b1 &&
18 git checkout b2 &&
19 echo b2 >>file &&
20 git commit -a -m b2
21'
22
8736a848 23test_expect_success 'prepare pushable branches' '
6fa92bf3
AR
24 cd aa &&
25 b1=$(git rev-parse origin/b1) &&
26 b2=$(git rev-parse origin/b2) &&
27 git checkout -b b1 origin/b1 &&
28 echo aa-b1 >>file &&
29 git commit -a -m aa-b1 &&
30 git checkout -b b2 origin/b2 &&
31 echo aa-b2 >>file &&
32 git commit -a -m aa-b2 &&
33 git checkout master &&
34 echo aa-master >>file &&
8736a848
JK
35 git commit -a -m aa-master
36'
37
38test_expect_success 'mixed-success push returns error' '! git push'
39
40test_expect_success 'check tracking branches updated correctly after push' '
41 test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
42'
43
44test_expect_success 'check tracking branches not updated for failed refs' '
6fa92bf3
AR
45 test "$(git rev-parse origin/b1)" = "$b1" &&
46 test "$(git rev-parse origin/b2)" = "$b2"
47'
48
1f0e2a1a
JK
49test_expect_success 'deleted branches have their tracking branches removed' '
50 git push origin :b1 &&
51 test "$(git rev-parse origin/b1)" = "origin/b1"
52'
53
0b294c0a
JK
54test_expect_success 'already deleted tracking branches ignored' '
55 git branch -d -r origin/b3 &&
56 git push origin :b3 >output 2>&1 &&
57 ! grep error output
58'
59
6fa92bf3 60test_done