Merge branch 'kf/post-receive-sample-hook'
[git/jnareb-git.git] / t / t5523-push-upstream.sh
blob00da70763bc34fe05dcba90a48799e32880571ce
1 #!/bin/sh
3 test_description='push with --set-upstream'
4 . ./test-lib.sh
6 test_expect_success 'setup bare parent' '
7 git init --bare parent &&
8 git remote add upstream parent
11 test_expect_success 'setup local commit' '
12 echo content >file &&
13 git add file &&
14 git commit -m one
17 check_config() {
18 (echo $2; echo $3) >expect.$1
19 (git config branch.$1.remote
20 git config branch.$1.merge) >actual.$1
21 test_cmp expect.$1 actual.$1
24 test_expect_success 'push -u master:master' '
25 git push -u upstream master:master &&
26 check_config master upstream refs/heads/master
29 test_expect_success 'push -u master:other' '
30 git push -u upstream master:other &&
31 check_config master upstream refs/heads/other
34 test_expect_success 'push -u --dry-run master:otherX' '
35 git push -u --dry-run upstream master:otherX &&
36 check_config master upstream refs/heads/other
39 test_expect_success 'push -u master2:master2' '
40 git branch master2 &&
41 git push -u upstream master2:master2 &&
42 check_config master2 upstream refs/heads/master2
45 test_expect_success 'push -u master2:other2' '
46 git push -u upstream master2:other2 &&
47 check_config master2 upstream refs/heads/other2
50 test_expect_success 'push -u :master2' '
51 git push -u upstream :master2 &&
52 check_config master2 upstream refs/heads/other2
55 test_expect_success 'push -u --all' '
56 git branch all1 &&
57 git branch all2 &&
58 git push -u --all &&
59 check_config all1 upstream refs/heads/all1 &&
60 check_config all2 upstream refs/heads/all2
63 test_expect_success 'push -u HEAD' '
64 git checkout -b headbranch &&
65 git push -u upstream HEAD &&
66 check_config headbranch upstream refs/heads/headbranch
69 test_done