3 test_description='check various push.default settings'
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 &&
12 git push parent1 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 &&
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 &&
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
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 &&
51 test_must_fail git push parent2