diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-26 10:51:18 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-26 10:51:18 -0700 |
commit | 731673b15ee886989afe57e50450e8ad9ed9dea3 (patch) | |
tree | 859ab5aa0cac18c01986180bd5cf0237c7476e34 /t | |
parent | 5d65c2ee88e09462a9fe11e7d739bc19bb8a3780 (diff) | |
parent | 135dadef712f0c4cf884940e751024c831937904 (diff) | |
download | git-731673b15ee886989afe57e50450e8ad9ed9dea3.tar.gz |
Merge branch 'jc/push-upstream-sanity' into maint
The 'push to upstream' implementation was broken in some corner
cases. "git push $there" without refspec, when the current branch is
set to push to a remote different from $there, used to push to $there
using the upstream information to a remote unreleated to $there.
* jc/push-upstream-sanity:
push: error out when the "upstream" semantics does not make sense
Diffstat (limited to 't')
-rwxr-xr-x | t/t5528-push-default.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh new file mode 100755 index 0000000000..c334c51a07 --- /dev/null +++ b/t/t5528-push-default.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +test_description='check various push.default settings' +. ./test-lib.sh + +test_expect_success 'setup bare remotes' ' + git init --bare repo1 && + git remote add parent1 repo1 && + git init --bare repo2 && + git remote add parent2 repo2 && + test_commit one && + git push parent1 HEAD && + git push parent2 HEAD +' + +test_expect_success '"upstream" pushes to configured upstream' ' + git checkout master && + test_config branch.master.remote parent1 && + test_config branch.master.merge refs/heads/foo && + test_config push.default upstream && + test_commit two && + git push && + echo two >expect && + git --git-dir=repo1 log -1 --format=%s foo >actual && + test_cmp expect actual +' + +test_expect_success '"upstream" does not push on unconfigured remote' ' + git checkout master && + test_unconfig branch.master.remote && + test_config push.default upstream && + test_commit three && + test_must_fail git push +' + +test_expect_success '"upstream" does not push on unconfigured branch' ' + git checkout master && + test_config branch.master.remote parent1 && + test_unconfig branch.master.merge && + test_config push.default upstream + test_commit four && + test_must_fail git push +' + +test_expect_success '"upstream" does not push when remotes do not match' ' + git checkout master && + test_config branch.master.remote parent1 && + test_config branch.master.merge refs/heads/foo && + test_config push.default upstream && + test_commit five && + test_must_fail git push parent2 +' + +test_done |