3 test_description='push with --set-upstream'
6 ensure_fresh_upstream() {
7 rm -rf parent && git init --bare parent
10 test_expect_success 'setup bare parent' '
11 ensure_fresh_upstream &&
12 git remote add upstream parent
15 test_expect_success 'setup local commit' '
22 (echo $2; echo $3) >expect.$1
23 (git config branch.$1.remote
24 git config branch.$1.merge) >actual.$1
25 test_cmp expect.$1 actual.$1
28 test_expect_success 'push -u master:master' '
29 git push -u upstream master:master &&
30 check_config master upstream refs/heads/master
33 test_expect_success 'push -u master:other' '
34 git push -u upstream master:other &&
35 check_config master upstream refs/heads/other
38 test_expect_success 'push -u --dry-run master:otherX' '
39 git push -u --dry-run upstream master:otherX &&
40 check_config master upstream refs/heads/other
43 test_expect_success 'push -u master2:master2' '
45 git push -u upstream master2:master2 &&
46 check_config master2 upstream refs/heads/master2
49 test_expect_success 'push -u master2:other2' '
50 git push -u upstream master2:other2 &&
51 check_config master2 upstream refs/heads/other2
54 test_expect_success 'push -u :master2' '
55 git push -u upstream :master2 &&
56 check_config master2 upstream refs/heads/other2
59 test_expect_success 'push -u --all' '
63 check_config all1 upstream refs/heads/all1 &&
64 check_config all2 upstream refs/heads/all2
67 test_expect_success 'push -u HEAD' '
68 git checkout -b headbranch &&
69 git push -u upstream HEAD &&
70 check_config headbranch upstream refs/heads/headbranch