diff options
author | Jeff King <peff@peff.net> | 2014-02-24 03:59:03 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-24 12:53:28 -0800 |
commit | 98b406f3ad6a6989a5b11c2a2582a9f539d66263 (patch) | |
tree | ea03420878d55379efbf4c3bb0a82ec1d43c4521 /t | |
parent | Git 1.8.5.5 (diff) | |
download | tgif-98b406f3ad6a6989a5b11c2a2582a9f539d66263.tar.xz |
remote: handle pushremote config in any order
The remote we push can be defined either by
remote.pushdefault or by branch.*.pushremote for the current
branch. The order in which they appear in the config file
should not matter to precedence (which should be to prefer
the branch-specific config).
The current code parses the config linearly and uses a
single string to store both values, overwriting any
previous value. Thus, config like:
[branch "master"]
pushremote = foo
[remote]
pushdefault = bar
erroneously ends up pushing to "bar" from the master branch.
We can fix this by storing both values and resolving the
correct value after all config is read.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t5516-fetch-push.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 99c32d7539..084a8cbd91 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -536,6 +536,19 @@ test_expect_success 'push with config branch.*.pushremote' ' check_push_result down_repo $the_commit heads/master ' +test_expect_success 'branch.*.pushremote config order is irrelevant' ' + mk_test one_repo heads/master && + mk_test two_repo heads/master && + test_config remote.one.url one_repo && + test_config remote.two.url two_repo && + test_config branch.master.pushremote two_repo && + test_config remote.pushdefault one_repo && + test_config push.default matching && + git push && + check_push_result one_repo $the_first_commit heads/master && + check_push_result two_repo $the_commit heads/master +' + test_expect_success 'push with dry-run' ' mk_test testrepo heads/master && |