]> git.ipfire.org Git - thirdparty/git.git/blame - t/t5404-tracking-branches.sh
git-commit.txt: Add missing long/short options
[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 &&
13 git clone . aa &&
14 git checkout b1 &&
15 echo b1 >>file &&
16 git commit -a -m b1 &&
17 git checkout b2 &&
18 echo b2 >>file &&
19 git commit -a -m b2
20'
21
8736a848 22test_expect_success 'prepare pushable branches' '
6fa92bf3
AR
23 cd aa &&
24 b1=$(git rev-parse origin/b1) &&
25 b2=$(git rev-parse origin/b2) &&
26 git checkout -b b1 origin/b1 &&
27 echo aa-b1 >>file &&
28 git commit -a -m aa-b1 &&
29 git checkout -b b2 origin/b2 &&
30 echo aa-b2 >>file &&
31 git commit -a -m aa-b2 &&
32 git checkout master &&
33 echo aa-master >>file &&
8736a848
JK
34 git commit -a -m aa-master
35'
36
37test_expect_success 'mixed-success push returns error' '! git push'
38
39test_expect_success 'check tracking branches updated correctly after push' '
40 test "$(git rev-parse origin/master)" = "$(git rev-parse master)"
41'
42
43test_expect_success 'check tracking branches not updated for failed refs' '
6fa92bf3
AR
44 test "$(git rev-parse origin/b1)" = "$b1" &&
45 test "$(git rev-parse origin/b2)" = "$b2"
46'
47
1f0e2a1a
JK
48test_expect_success 'deleted branches have their tracking branches removed' '
49 git push origin :b1 &&
50 test "$(git rev-parse origin/b1)" = "origin/b1"
51'
52
6fa92bf3 53test_done