Merge branch 'rl/show-empty-prefix' into maint
[git/raj.git] / t / t5528-push-default.sh
blobc334c51a0740966090abb6f55fb90914734ff787
1 #!/bin/sh
3 test_description='check various push.default settings'
4 . ./test-lib.sh
6 test_expect_success 'setup bare remotes' '
7 git init --bare repo1 &&
8 git remote add parent1 repo1 &&
9 git init --bare repo2 &&
10 git remote add parent2 repo2 &&
11 test_commit one &&
12 git push parent1 HEAD &&
13 git push parent2 HEAD
16 test_expect_success '"upstream" pushes to configured upstream' '
17 git checkout master &&
18 test_config branch.master.remote parent1 &&
19 test_config branch.master.merge refs/heads/foo &&
20 test_config push.default upstream &&
21 test_commit two &&
22 git push &&
23 echo two >expect &&
24 git --git-dir=repo1 log -1 --format=%s foo >actual &&
25 test_cmp expect actual
28 test_expect_success '"upstream" does not push on unconfigured remote' '
29 git checkout master &&
30 test_unconfig branch.master.remote &&
31 test_config push.default upstream &&
32 test_commit three &&
33 test_must_fail git push
36 test_expect_success '"upstream" does not push on unconfigured branch' '
37 git checkout master &&
38 test_config branch.master.remote parent1 &&
39 test_unconfig branch.master.merge &&
40 test_config push.default upstream
41 test_commit four &&
42 test_must_fail git push
45 test_expect_success '"upstream" does not push when remotes do not match' '
46 git checkout master &&
47 test_config branch.master.remote parent1 &&
48 test_config branch.master.merge refs/heads/foo &&
49 test_config push.default upstream &&
50 test_commit five &&
51 test_must_fail git push parent2
54 test_done