{"thread":{"id":"33347","subject":"[PATCH 0/6] Re-roll rr/triangle","startedAt":"2013-04-02T07:40:28Z","lastAt":"2013-04-02T17:52:25Z","messageCount":10,"participants":["Ramkumar Ramachandra","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"212851","messageId":"1364888434-30388-1-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":null,"subject":"[PATCH 0/6] Re-roll rr/triangle","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:28Z","receivedAt":"2013-04-02T07:40:28Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"There are two important changes in this round:\n\n1. Rebased on latest master, resolving all conflicts (all in t5516).\n   I ran the testsuite immediately after resolving the conflicts, so\n   everything should be good.\n\n2. Peff's suggestion to avoid using test_must_fail on compound\n   statements.  I've changed the meaning of the tests slightly to\n   (approximately) invert the tests.  The inter-diff follows.\n\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex 13028a4..3281ff1 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -521,14 +521,14 @@ git config --remove-section remote.there\n git config --remove-section branch.master\n \n test_expect_success 'push with remote.pushdefault' '\n-\tmk_test up_repo heads/frotz &&\n+\tmk_test up_repo heads/master &&\n \tmk_test down_repo heads/master &&\n \ttest_config remote.up.url up_repo &&\n \ttest_config remote.down.url down_repo &&\n \ttest_config branch.master.remote up &&\n \ttest_config remote.pushdefault down &&\n \tgit push &&\n-\ttest_must_fail check_push_result up_repo $the_commit heads/master &&\n+\tcheck_push_result up_repo $the_first_commit heads/master &&\n \tcheck_push_result down_repo $the_commit heads/master\n '\n \n@@ -543,8 +543,8 @@ test_expect_success 'push with config remote.*.pushurl' '\n '\n \n test_expect_success 'push with config branch.*.pushremote' '\n-\tmk_test up_repo heads/frotz &&\n-\tmk_test side_repo heads/quux &&\n+\tmk_test up_repo heads/master &&\n+\tmk_test side_repo heads/master &&\n \tmk_test down_repo heads/master &&\n \ttest_config remote.up.url up_repo &&\n \ttest_config remote.pushdefault side_repo &&\n@@ -552,8 +552,8 @@ test_expect_success 'push with config branch.*.pushremote' '\n \ttest_config branch.master.remote up &&\n \ttest_config branch.master.pushremote down &&\n \tgit push &&\n-\ttest_must_fail check_push_result up_repo $the_commit heads/master &&\n-\ttest_must_fail check_push_result side_repo $the_commit heads/master &&\n+\tcheck_push_result up_repo $the_first_commit heads/master &&\n+\tcheck_push_result side_repo $the_first_commit heads/master &&\n \tcheck_push_result down_repo $the_commit heads/master\n '\n\nJeff King (1):\n  t5516 (fetch-push): drop implicit arguments from helper functions\n\nRamkumar Ramachandra (5):\n  remote.c: simplify a bit of code using git_config_string()\n  t5516 (fetch-push): update test description\n  remote.c: introduce a way to have different remotes for fetch/push\n  remote.c: introduce remote.pushdefault\n  remote.c: introduce branch.<name>.pushremote\n\n Documentation/config.txt |  24 +++-\n builtin/push.c           |   2 +-\n remote.c                 |  41 ++++--\n remote.h                 |   1 +\n t/t5516-fetch-push.sh    | 322 +++++++++++++++++++++++++++--------------------\n 5 files changed, 241 insertions(+), 149 deletions(-)\n\n-- \n1.8.2.363.g901f5bc\n"},{"id":"212852","messageId":"1364888434-30388-2-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 1/6] remote.c: simplify a bit of code using git_config_string()","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:29Z","receivedAt":"2013-04-02T07:40:29Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"A small segment where handle_config() parses the branch.remote\nconfiguration variable can be simplified using git_config_string().\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n remote.c | 5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)\n\ndiff --git a/remote.c b/remote.c\nindex ca1edd9..34ddc5b 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -357,9 +357,8 @@ static int handle_config(const char *key, const char *value, void *cb)\n \t\t\treturn 0;\n \t\tbranch = make_branch(name, subkey - name);\n \t\tif (!strcmp(subkey, \".remote\")) {\n-\t\t\tif (!value)\n-\t\t\t\treturn config_error_nonbool(key);\n-\t\t\tbranch->remote_name = xstrdup(value);\n+\t\t\tif (git_config_string(&branch->remote_name, key, value))\n+\t\t\t\treturn -1;\n \t\t\tif (branch == current_branch) {\n \t\t\t\tdefault_remote_name = branch->remote_name;\n \t\t\t\texplicit_default_remote_name = 1;\n-- \n1.8.2.363.g901f5bc\n"},{"id":"212853","messageId":"1364888434-30388-3-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 2/6] t5516 (fetch-push): update test description","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:30Z","receivedAt":"2013-04-02T07:40:30Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"The file was originally created in bcdb34f (Test wildcard push/fetch,\n2007-06-08), and only contained tests that exercised wildcard\nfunctionality at the time.  In subsequent commits, many other tests\nunrelated to wildcards were added but the test description was never\nupdated.  Fix this.\n\nHelped-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t5516-fetch-push.sh | 13 ++++++++++++-\n 1 file changed, 12 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex 383a2eb..f394271 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -1,6 +1,17 @@\n #!/bin/sh\n \n-test_description='fetching and pushing, with or without wildcard'\n+test_description='Basic fetch/push functionality.\n+\n+This test checks the following functionality:\n+\n+* command-line syntax\n+* refspecs\n+* fast-forward detection, and overriding it\n+* configuration\n+* hooks\n+* --porcelain output format\n+* hiderefs\n+'\n \n . ./test-lib.sh\n \n-- \n1.8.2.363.g901f5bc\n"},{"id":"212855","messageId":"1364888434-30388-4-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 3/6] t5516 (fetch-push): drop implicit arguments from helper functions","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:31Z","receivedAt":"2013-04-02T07:40:31Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nMany of the tests in t5516 look like:\n\n  mk_empty &&\n  git push testrepo ... &&\n  check_push_result $commit heads/master\n\nIt's reasonably easy to see what is being tested, with the\nexception that \"testrepo\" is a magic global name (it is\nimplicitly used in the helpers, but we have to name it\nexplicitly when calling git directly). Let's make it\nexplicit when call the helpers, too. This is slightly more\ntyping, but makes the test snippets read more naturally.\n\nIt also makes it easy for future tests to use an alternate\nor multiple repositories, without a proliferation of helper\nfunctions.\n\n[rr: fixed sloppy quoting]\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n t/t5516-fetch-push.sh | 282 ++++++++++++++++++++++++++------------------------\n 1 file changed, 145 insertions(+), 137 deletions(-)\n\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex f394271..b800a8e 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -18,10 +18,11 @@ This test checks the following functionality:\n D=`pwd`\n \n mk_empty () {\n-\trm -fr testrepo &&\n-\tmkdir testrepo &&\n+\trepo_name=\"$1\"\n+\trm -fr \"$repo_name\" &&\n+\tmkdir \"$repo_name\" &&\n \t(\n-\t\tcd testrepo &&\n+\t\tcd \"$repo_name\" &&\n \t\tgit init &&\n \t\tgit config receive.denyCurrentBranch warn &&\n \t\tmv .git/hooks .git/hooks-disabled\n@@ -29,14 +30,17 @@ mk_empty () {\n }\n \n mk_test () {\n-\tmk_empty &&\n+\trepo_name=\"$1\"\n+\tshift\n+\n+\tmk_empty \"$repo_name\" &&\n \t(\n \t\tfor ref in \"$@\"\n \t\tdo\n-\t\t\tgit push testrepo $the_first_commit:refs/$ref ||\n+\t\t\tgit push \"$repo_name\" $the_first_commit:refs/$ref ||\n \t\t\texit\n \t\tdone &&\n-\t\tcd testrepo &&\n+\t\tcd \"$repo_name\" &&\n \t\tfor ref in \"$@\"\n \t\tdo\n \t\t\techo \"$the_first_commit\" >expect &&\n@@ -49,9 +53,10 @@ mk_test () {\n }\n \n mk_test_with_hooks() {\n+\trepo_name=$1\n \tmk_test \"$@\" &&\n \t(\n-\t\tcd testrepo &&\n+\t\tcd \"$repo_name\" &&\n \t\tmkdir .git/hooks &&\n \t\tcd .git/hooks &&\n \n@@ -83,13 +88,16 @@ mk_test_with_hooks() {\n }\n \n mk_child() {\n-\trm -rf \"$1\" &&\n-\tgit clone testrepo \"$1\"\n+\trm -rf \"$2\" &&\n+\tgit clone \"$1\" \"$2\"\n }\n \n check_push_result () {\n+\trepo_name=\"$1\"\n+\tshift\n+\n \t(\n-\t\tcd testrepo &&\n+\t\tcd \"$repo_name\" &&\n \t\techo \"$1\" >expect &&\n \t\tshift &&\n \t\tfor ref in \"$@\"\n@@ -119,7 +127,7 @@ test_expect_success setup '\n '\n \n test_expect_success 'fetch without wildcard' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \t(\n \t\tcd testrepo &&\n \t\tgit fetch .. refs/heads/master:refs/remotes/origin/master &&\n@@ -131,7 +139,7 @@ test_expect_success 'fetch without wildcard' '\n '\n \n test_expect_success 'fetch with wildcard' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \t(\n \t\tcd testrepo &&\n \t\tgit config remote.up.url .. &&\n@@ -145,7 +153,7 @@ test_expect_success 'fetch with wildcard' '\n '\n \n test_expect_success 'fetch with insteadOf' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \t(\n \t\tTRASH=$(pwd)/ &&\n \t\tcd testrepo &&\n@@ -161,7 +169,7 @@ test_expect_success 'fetch with insteadOf' '\n '\n \n test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \t(\n \t\tTRASH=$(pwd)/ &&\n \t\tcd testrepo &&\n@@ -177,7 +185,7 @@ test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '\n '\n \n test_expect_success 'push without wildcard' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \n \tgit push testrepo refs/heads/master:refs/remotes/origin/master &&\n \t(\n@@ -189,7 +197,7 @@ test_expect_success 'push without wildcard' '\n '\n \n test_expect_success 'push with wildcard' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \n \tgit push testrepo \"refs/heads/*:refs/remotes/origin/*\" &&\n \t(\n@@ -201,7 +209,7 @@ test_expect_success 'push with wildcard' '\n '\n \n test_expect_success 'push with insteadOf' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tTRASH=\"$(pwd)/\" &&\n \ttest_config \"url.$TRASH.insteadOf\" trash/ &&\n \tgit push trash/testrepo refs/heads/master:refs/remotes/origin/master &&\n@@ -214,7 +222,7 @@ test_expect_success 'push with insteadOf' '\n '\n \n test_expect_success 'push with pushInsteadOf' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tTRASH=\"$(pwd)/\" &&\n \ttest_config \"url.$TRASH.pushInsteadOf\" trash/ &&\n \tgit push trash/testrepo refs/heads/master:refs/remotes/origin/master &&\n@@ -227,7 +235,7 @@ test_expect_success 'push with pushInsteadOf' '\n '\n \n test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tTRASH=\"$(pwd)/\" &&\n \ttest_config \"url.trash2/.pushInsteadOf\" trash/ &&\n \ttest_config remote.r.url trash/wrong &&\n@@ -243,237 +251,237 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf\n \n test_expect_success 'push with matching heads' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit push testrepo &&\n-\tcheck_push_result $the_commit heads/master\n+\tcheck_push_result testrepo $the_commit heads/master\n \n '\n \n test_expect_success 'push with matching heads on the command line' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit push testrepo : &&\n-\tcheck_push_result $the_commit heads/master\n+\tcheck_push_result testrepo $the_commit heads/master\n \n '\n \n test_expect_success 'failed (non-fast-forward) push with matching heads' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit push testrepo : &&\n \tgit commit --amend -massaged &&\n \ttest_must_fail git push testrepo &&\n-\tcheck_push_result $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_commit heads/master &&\n \tgit reset --hard $the_commit\n \n '\n \n test_expect_success 'push --force with matching heads' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit push testrepo : &&\n \tgit commit --amend -massaged &&\n \tgit push --force testrepo &&\n-\t! check_push_result $the_commit heads/master &&\n+\t! check_push_result testrepo $the_commit heads/master &&\n \tgit reset --hard $the_commit\n \n '\n \n test_expect_success 'push with matching heads and forced update' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit push testrepo : &&\n \tgit commit --amend -massaged &&\n \tgit push testrepo +: &&\n-\t! check_push_result $the_commit heads/master &&\n+\t! check_push_result testrepo $the_commit heads/master &&\n \tgit reset --hard $the_commit\n \n '\n \n test_expect_success 'push with no ambiguity (1)' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit push testrepo master:master &&\n-\tcheck_push_result $the_commit heads/master\n+\tcheck_push_result testrepo $the_commit heads/master\n \n '\n \n test_expect_success 'push with no ambiguity (2)' '\n \n-\tmk_test remotes/origin/master &&\n+\tmk_test testrepo remotes/origin/master &&\n \tgit push testrepo master:origin/master &&\n-\tcheck_push_result $the_commit remotes/origin/master\n+\tcheck_push_result testrepo $the_commit remotes/origin/master\n \n '\n \n test_expect_success 'push with colon-less refspec, no ambiguity' '\n \n-\tmk_test heads/master heads/t/master &&\n+\tmk_test testrepo heads/master heads/t/master &&\n \tgit branch -f t/master master &&\n \tgit push testrepo master &&\n-\tcheck_push_result $the_commit heads/master &&\n-\tcheck_push_result $the_first_commit heads/t/master\n+\tcheck_push_result testrepo $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_first_commit heads/t/master\n \n '\n \n test_expect_success 'push with weak ambiguity (1)' '\n \n-\tmk_test heads/master remotes/origin/master &&\n+\tmk_test testrepo heads/master remotes/origin/master &&\n \tgit push testrepo master:master &&\n-\tcheck_push_result $the_commit heads/master &&\n-\tcheck_push_result $the_first_commit remotes/origin/master\n+\tcheck_push_result testrepo $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_first_commit remotes/origin/master\n \n '\n \n test_expect_success 'push with weak ambiguity (2)' '\n \n-\tmk_test heads/master remotes/origin/master remotes/another/master &&\n+\tmk_test testrepo heads/master remotes/origin/master remotes/another/master &&\n \tgit push testrepo master:master &&\n-\tcheck_push_result $the_commit heads/master &&\n-\tcheck_push_result $the_first_commit remotes/origin/master remotes/another/master\n+\tcheck_push_result testrepo $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_first_commit remotes/origin/master remotes/another/master\n \n '\n \n test_expect_success 'push with ambiguity' '\n \n-\tmk_test heads/frotz tags/frotz &&\n+\tmk_test testrepo heads/frotz tags/frotz &&\n \ttest_must_fail git push testrepo master:frotz &&\n-\tcheck_push_result $the_first_commit heads/frotz tags/frotz\n+\tcheck_push_result testrepo $the_first_commit heads/frotz tags/frotz\n \n '\n \n test_expect_success 'push with colon-less refspec (1)' '\n \n-\tmk_test heads/frotz tags/frotz &&\n+\tmk_test testrepo heads/frotz tags/frotz &&\n \tgit branch -f frotz master &&\n \tgit push testrepo frotz &&\n-\tcheck_push_result $the_commit heads/frotz &&\n-\tcheck_push_result $the_first_commit tags/frotz\n+\tcheck_push_result testrepo $the_commit heads/frotz &&\n+\tcheck_push_result testrepo $the_first_commit tags/frotz\n \n '\n \n test_expect_success 'push with colon-less refspec (2)' '\n \n-\tmk_test heads/frotz tags/frotz &&\n+\tmk_test testrepo heads/frotz tags/frotz &&\n \tif git show-ref --verify -q refs/heads/frotz\n \tthen\n \t\tgit branch -D frotz\n \tfi &&\n \tgit tag -f frotz &&\n \tgit push -f testrepo frotz &&\n-\tcheck_push_result $the_commit tags/frotz &&\n-\tcheck_push_result $the_first_commit heads/frotz\n+\tcheck_push_result testrepo $the_commit tags/frotz &&\n+\tcheck_push_result testrepo $the_first_commit heads/frotz\n \n '\n \n test_expect_success 'push with colon-less refspec (3)' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \tif git show-ref --verify -q refs/tags/frotz\n \tthen\n \t\tgit tag -d frotz\n \tfi &&\n \tgit branch -f frotz master &&\n \tgit push testrepo frotz &&\n-\tcheck_push_result $the_commit heads/frotz &&\n+\tcheck_push_result testrepo $the_commit heads/frotz &&\n \ttest 1 = $( cd testrepo && git show-ref | wc -l )\n '\n \n test_expect_success 'push with colon-less refspec (4)' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \tif git show-ref --verify -q refs/heads/frotz\n \tthen\n \t\tgit branch -D frotz\n \tfi &&\n \tgit tag -f frotz &&\n \tgit push testrepo frotz &&\n-\tcheck_push_result $the_commit tags/frotz &&\n+\tcheck_push_result testrepo $the_commit tags/frotz &&\n \ttest 1 = $( cd testrepo && git show-ref | wc -l )\n \n '\n \n test_expect_success 'push head with non-existent, incomplete dest' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \tgit push testrepo master:branch &&\n-\tcheck_push_result $the_commit heads/branch\n+\tcheck_push_result testrepo $the_commit heads/branch\n \n '\n \n test_expect_success 'push tag with non-existent, incomplete dest' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \tgit tag -f v1.0 &&\n \tgit push testrepo v1.0:tag &&\n-\tcheck_push_result $the_commit tags/tag\n+\tcheck_push_result testrepo $the_commit tags/tag\n \n '\n \n test_expect_success 'push sha1 with non-existent, incomplete dest' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \ttest_must_fail git push testrepo `git rev-parse master`:foo\n \n '\n \n test_expect_success 'push ref expression with non-existent, incomplete dest' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \ttest_must_fail git push testrepo master^:branch\n \n '\n \n test_expect_success 'push with HEAD' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit checkout master &&\n \tgit push testrepo HEAD &&\n-\tcheck_push_result $the_commit heads/master\n+\tcheck_push_result testrepo $the_commit heads/master\n \n '\n \n test_expect_success 'push with HEAD nonexisting at remote' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit checkout -b local master &&\n \tgit push testrepo HEAD &&\n-\tcheck_push_result $the_commit heads/local\n+\tcheck_push_result testrepo $the_commit heads/local\n '\n \n test_expect_success 'push with +HEAD' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit checkout master &&\n \tgit branch -D local &&\n \tgit checkout -b local &&\n \tgit push testrepo master local &&\n-\tcheck_push_result $the_commit heads/master &&\n-\tcheck_push_result $the_commit heads/local &&\n+\tcheck_push_result testrepo $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_commit heads/local &&\n \n \t# Without force rewinding should fail\n \tgit reset --hard HEAD^ &&\n \ttest_must_fail git push testrepo HEAD &&\n-\tcheck_push_result $the_commit heads/local &&\n+\tcheck_push_result testrepo $the_commit heads/local &&\n \n \t# With force rewinding should succeed\n \tgit push testrepo +HEAD &&\n-\tcheck_push_result $the_first_commit heads/local\n+\tcheck_push_result testrepo $the_first_commit heads/local\n \n '\n \n test_expect_success 'push HEAD with non-existent, incomplete dest' '\n \n-\tmk_test &&\n+\tmk_test testrepo &&\n \tgit checkout master &&\n \tgit push testrepo HEAD:branch &&\n-\tcheck_push_result $the_commit heads/branch\n+\tcheck_push_result testrepo $the_commit heads/branch\n \n '\n \n test_expect_success 'push with config remote.*.push = HEAD' '\n \n-\tmk_test heads/local &&\n+\tmk_test testrepo heads/local &&\n \tgit checkout master &&\n \tgit branch -f local $the_commit &&\n \t(\n@@ -485,35 +493,35 @@ test_expect_success 'push with config remote.*.push = HEAD' '\n \ttest_config remote.there.push HEAD &&\n \ttest_config branch.master.remote there &&\n \tgit push &&\n-\tcheck_push_result $the_commit heads/master &&\n-\tcheck_push_result $the_first_commit heads/local\n+\tcheck_push_result testrepo $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_first_commit heads/local\n '\n \n test_expect_success 'push with config remote.*.pushurl' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit checkout master &&\n \ttest_config remote.there.url test2repo &&\n \ttest_config remote.there.pushurl testrepo &&\n \tgit push there &&\n-\tcheck_push_result $the_commit heads/master\n+\tcheck_push_result testrepo $the_commit heads/master\n '\n \n test_expect_success 'push with dry-run' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \t(\n \t\tcd testrepo &&\n \t\told_commit=$(git show-ref -s --verify refs/heads/master)\n \t) &&\n \tgit push --dry-run testrepo &&\n-\tcheck_push_result $old_commit heads/master\n+\tcheck_push_result testrepo $old_commit heads/master\n '\n \n test_expect_success 'push updates local refs' '\n \n-\tmk_test heads/master &&\n-\tmk_child child &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child &&\n \t(\n \t\tcd child &&\n \t\tgit pull .. master &&\n@@ -526,9 +534,9 @@ test_expect_success 'push updates local refs' '\n \n test_expect_success 'push updates up-to-date local refs' '\n \n-\tmk_test heads/master &&\n-\tmk_child child1 &&\n-\tmk_child child2 &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child1 &&\n+\tmk_child testrepo child2 &&\n \t(cd child1 && git pull .. master && git push) &&\n \t(\n \t\tcd child2 &&\n@@ -542,8 +550,8 @@ test_expect_success 'push updates up-to-date local refs' '\n \n test_expect_success 'push preserves up-to-date packed refs' '\n \n-\tmk_test heads/master &&\n-\tmk_child child &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child &&\n \t(\n \t\tcd child &&\n \t\tgit push &&\n@@ -554,8 +562,8 @@ test_expect_success 'push preserves up-to-date packed refs' '\n \n test_expect_success 'push does not update local refs on failure' '\n \n-\tmk_test heads/master &&\n-\tmk_child child &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child &&\n \tmkdir testrepo/.git/hooks &&\n \techo \"#!/no/frobnication/today\" >testrepo/.git/hooks/pre-receive &&\n \tchmod +x testrepo/.git/hooks/pre-receive &&\n@@ -571,7 +579,7 @@ test_expect_success 'push does not update local refs on failure' '\n \n test_expect_success 'allow deleting an invalid remote ref' '\n \n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \trm -f testrepo/.git/objects/??/* &&\n \tgit push testrepo :refs/heads/master &&\n \t(cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)\n@@ -579,7 +587,7 @@ test_expect_success 'allow deleting an invalid remote ref' '\n '\n \n test_expect_success 'pushing valid refs triggers post-receive and post-update hooks' '\n-\tmk_test_with_hooks heads/master heads/next &&\n+\tmk_test_with_hooks testrepo heads/master heads/next &&\n \torgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&\n \tnewmaster=$(git show-ref -s --verify refs/heads/master) &&\n \torgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&\n@@ -615,7 +623,7 @@ test_expect_success 'pushing valid refs triggers post-receive and post-update ho\n '\n \n test_expect_success 'deleting dangling ref triggers hooks with correct args' '\n-\tmk_test_with_hooks heads/master &&\n+\tmk_test_with_hooks testrepo heads/master &&\n \trm -f testrepo/.git/objects/??/* &&\n \tgit push testrepo :refs/heads/master &&\n \t(\n@@ -644,7 +652,7 @@ test_expect_success 'deleting dangling ref triggers hooks with correct args' '\n '\n \n test_expect_success 'deletion of a non-existent ref is not fed to post-receive and post-update hooks' '\n-\tmk_test_with_hooks heads/master &&\n+\tmk_test_with_hooks testrepo heads/master &&\n \torgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&\n \tnewmaster=$(git show-ref -s --verify refs/heads/master) &&\n \tgit push testrepo master :refs/heads/nonexistent &&\n@@ -676,7 +684,7 @@ test_expect_success 'deletion of a non-existent ref is not fed to post-receive a\n '\n \n test_expect_success 'deletion of a non-existent ref alone does trigger post-receive and post-update hooks' '\n-\tmk_test_with_hooks heads/master &&\n+\tmk_test_with_hooks testrepo heads/master &&\n \tgit push testrepo :refs/heads/nonexistent &&\n \t(\n \t\tcd testrepo/.git &&\n@@ -696,7 +704,7 @@ test_expect_success 'deletion of a non-existent ref alone does trigger post-rece\n '\n \n test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks with correct input' '\n-\tmk_test_with_hooks heads/master heads/next heads/pu &&\n+\tmk_test_with_hooks testrepo heads/master heads/next heads/pu &&\n \torgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&\n \tnewmaster=$(git show-ref -s --verify refs/heads/master) &&\n \torgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&\n@@ -742,14 +750,14 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w\n '\n \n test_expect_success 'allow deleting a ref using --delete' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \t(cd testrepo && git config receive.denyDeleteCurrent warn) &&\n \tgit push testrepo --delete master &&\n \t(cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)\n '\n \n test_expect_success 'allow deleting a tag using --delete' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \tgit tag -a -m dummy_message deltag heads/master &&\n \tgit push testrepo --tags &&\n \t(cd testrepo && git rev-parse --verify -q refs/tags/deltag) &&\n@@ -758,17 +766,17 @@ test_expect_success 'allow deleting a tag using --delete' '\n '\n \n test_expect_success 'push --delete without args aborts' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \ttest_must_fail git push testrepo --delete\n '\n \n test_expect_success 'push --delete refuses src:dest refspecs' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \ttest_must_fail git push testrepo --delete master:foo\n '\n \n test_expect_success 'warn on push to HEAD of non-bare repository' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \t(\n \t\tcd testrepo &&\n \t\tgit checkout master &&\n@@ -779,7 +787,7 @@ test_expect_success 'warn on push to HEAD of non-bare repository' '\n '\n \n test_expect_success 'deny push to HEAD of non-bare repository' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \t(\n \t\tcd testrepo &&\n \t\tgit checkout master &&\n@@ -789,7 +797,7 @@ test_expect_success 'deny push to HEAD of non-bare repository' '\n '\n \n test_expect_success 'allow push to HEAD of bare repository (bare)' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \t(\n \t\tcd testrepo &&\n \t\tgit checkout master &&\n@@ -801,7 +809,7 @@ test_expect_success 'allow push to HEAD of bare repository (bare)' '\n '\n \n test_expect_success 'allow push to HEAD of non-bare repository (config)' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \t(\n \t\tcd testrepo &&\n \t\tgit checkout master &&\n@@ -812,7 +820,7 @@ test_expect_success 'allow push to HEAD of non-bare repository (config)' '\n '\n \n test_expect_success 'fetch with branches' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tgit branch second $the_first_commit &&\n \tgit checkout second &&\n \techo \"..\" > testrepo/.git/branches/branch1 &&\n@@ -827,7 +835,7 @@ test_expect_success 'fetch with branches' '\n '\n \n test_expect_success 'fetch with branches containing #' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \techo \"..#second\" > testrepo/.git/branches/branch2 &&\n \t(\n \t\tcd testrepo &&\n@@ -840,7 +848,7 @@ test_expect_success 'fetch with branches containing #' '\n '\n \n test_expect_success 'push with branches' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tgit checkout second &&\n \techo \"testrepo\" > .git/branches/branch1 &&\n \tgit push branch1 &&\n@@ -853,7 +861,7 @@ test_expect_success 'push with branches' '\n '\n \n test_expect_success 'push with branches containing #' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \techo \"testrepo#branch3\" > .git/branches/branch2 &&\n \tgit push branch2 &&\n \t(\n@@ -866,9 +874,9 @@ test_expect_success 'push with branches containing #' '\n '\n \n test_expect_success 'push into aliased refs (consistent)' '\n-\tmk_test heads/master &&\n-\tmk_child child1 &&\n-\tmk_child child2 &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child1 &&\n+\tmk_child testrepo child2 &&\n \t(\n \t\tcd child1 &&\n \t\tgit branch foo &&\n@@ -888,9 +896,9 @@ test_expect_success 'push into aliased refs (consistent)' '\n '\n \n test_expect_success 'push into aliased refs (inconsistent)' '\n-\tmk_test heads/master &&\n-\tmk_child child1 &&\n-\tmk_child child2 &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child1 &&\n+\tmk_child testrepo child2 &&\n \t(\n \t\tcd child1 &&\n \t\tgit branch foo &&\n@@ -915,9 +923,9 @@ test_expect_success 'push into aliased refs (inconsistent)' '\n '\n \n test_expect_success 'push requires --force to update lightweight tag' '\n-\tmk_test heads/master &&\n-\tmk_child child1 &&\n-\tmk_child child2 &&\n+\tmk_test testrepo heads/master &&\n+\tmk_child testrepo child1 &&\n+\tmk_child testrepo child2 &&\n \t(\n \t\tcd child1 &&\n \t\tgit tag Tag &&\n@@ -936,7 +944,7 @@ test_expect_success 'push requires --force to update lightweight tag' '\n '\n \n test_expect_success 'push --porcelain' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \techo >.git/foo  \"To testrepo\" &&\n \techo >>.git/foo \"*\trefs/heads/master:refs/remotes/origin/master\t[new branch]\"  &&\n \techo >>.git/foo \"Done\" &&\n@@ -951,13 +959,13 @@ test_expect_success 'push --porcelain' '\n '\n \n test_expect_success 'push --porcelain bad url' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \ttest_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/master:refs/remotes/origin/master &&\n \ttest_must_fail grep -q Done .git/bar\n '\n \n test_expect_success 'push --porcelain rejected' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tgit push testrepo refs/heads/master:refs/remotes/origin/master &&\n \t(cd testrepo &&\n \t\tgit reset --hard origin/master^\n@@ -971,7 +979,7 @@ test_expect_success 'push --porcelain rejected' '\n '\n \n test_expect_success 'push --porcelain --dry-run rejected' '\n-\tmk_empty &&\n+\tmk_empty testrepo &&\n \tgit push testrepo refs/heads/master:refs/remotes/origin/master &&\n \t(cd testrepo &&\n \t\tgit reset --hard origin/master\n@@ -986,25 +994,25 @@ test_expect_success 'push --porcelain --dry-run rejected' '\n '\n \n test_expect_success 'push --prune' '\n-\tmk_test heads/master heads/second heads/foo heads/bar &&\n+\tmk_test testrepo heads/master heads/second heads/foo heads/bar &&\n \tgit push --prune testrepo &&\n-\tcheck_push_result $the_commit heads/master &&\n-\tcheck_push_result $the_first_commit heads/second &&\n-\t! check_push_result $the_first_commit heads/foo heads/bar\n+\tcheck_push_result testrepo $the_commit heads/master &&\n+\tcheck_push_result testrepo $the_first_commit heads/second &&\n+\t! check_push_result testrepo $the_first_commit heads/foo heads/bar\n '\n \n test_expect_success 'push --prune refspec' '\n-\tmk_test tmp/master tmp/second tmp/foo tmp/bar &&\n+\tmk_test testrepo tmp/master tmp/second tmp/foo tmp/bar &&\n \tgit push --prune testrepo \"refs/heads/*:refs/tmp/*\" &&\n-\tcheck_push_result $the_commit tmp/master &&\n-\tcheck_push_result $the_first_commit tmp/second &&\n-\t! check_push_result $the_first_commit tmp/foo tmp/bar\n+\tcheck_push_result testrepo $the_commit tmp/master &&\n+\tcheck_push_result testrepo $the_first_commit tmp/second &&\n+\t! check_push_result testrepo $the_first_commit tmp/foo tmp/bar\n '\n \n for configsection in transfer receive\n do\n \ttest_expect_success \"push to update a ref hidden by $configsection.hiderefs\" '\n-\t\tmk_test heads/master hidden/one hidden/two hidden/three &&\n+\t\tmk_test testrepo heads/master hidden/one hidden/two hidden/three &&\n \t\t(\n \t\t\tcd testrepo &&\n \t\t\tgit config $configsection.hiderefs refs/hidden\n@@ -1012,32 +1020,32 @@ do\n \n \t\t# push to unhidden ref succeeds normally\n \t\tgit push testrepo master:refs/heads/master &&\n-\t\tcheck_push_result $the_commit heads/master &&\n+\t\tcheck_push_result testrepo $the_commit heads/master &&\n \n \t\t# push to update a hidden ref should fail\n \t\ttest_must_fail git push testrepo master:refs/hidden/one &&\n-\t\tcheck_push_result $the_first_commit hidden/one &&\n+\t\tcheck_push_result testrepo $the_first_commit hidden/one &&\n \n \t\t# push to delete a hidden ref should fail\n \t\ttest_must_fail git push testrepo :refs/hidden/two &&\n-\t\tcheck_push_result $the_first_commit hidden/two &&\n+\t\tcheck_push_result testrepo $the_first_commit hidden/two &&\n \n \t\t# idempotent push to update a hidden ref should fail\n \t\ttest_must_fail git push testrepo $the_first_commit:refs/hidden/three &&\n-\t\tcheck_push_result $the_first_commit hidden/three\n+\t\tcheck_push_result testrepo $the_first_commit hidden/three\n \t'\n done\n \n test_expect_success 'fetch exact SHA1' '\n-\tmk_test heads/master hidden/one &&\n+\tmk_test testrepo heads/master hidden/one &&\n \tgit push testrepo master:refs/hidden/one &&\n \t(\n \t\tcd testrepo &&\n \t\tgit config transfer.hiderefs refs/hidden\n \t) &&\n-\tcheck_push_result $the_commit hidden/one &&\n+\tcheck_push_result testrepo $the_commit hidden/one &&\n \n-\tmk_child child &&\n+\tmk_child testrepo child &&\n \t(\n \t\tcd child &&\n \n@@ -1063,7 +1071,7 @@ test_expect_success 'fetch exact SHA1' '\n '\n \n test_expect_success 'fetch follows tags by default' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \trm -fr src dst &&\n \tgit init src &&\n \t(\n@@ -1090,7 +1098,7 @@ test_expect_success 'fetch follows tags by default' '\n '\n \n test_expect_success 'push does not follow tags by default' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \trm -fr src dst &&\n \tgit init src &&\n \tgit init --bare dst &&\n@@ -1113,7 +1121,7 @@ test_expect_success 'push does not follow tags by default' '\n '\n \n test_expect_success 'push --follow-tag only pushes relevant tags' '\n-\tmk_test heads/master &&\n+\tmk_test testrepo heads/master &&\n \trm -fr src dst &&\n \tgit init src &&\n \tgit init --bare dst &&\n-- \n1.8.2.363.g901f5bc\n"},{"id":"212857","messageId":"1364888434-30388-5-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 4/6] remote.c: introduce a way to have different remotes for fetch/push","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:32Z","receivedAt":"2013-04-02T07:40:32Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Currently, do_push() in push.c calls remote_get(), which gets the\nconfigured remote for fetching and pushing.  Replace this call with a\ncall to pushremote_get() instead, a new function that will return the\nremote configured specifically for pushing.  This function tries to\nwork with the string pushremote_name, before falling back to the\ncodepath of remote_get().  This patch has no visible impact, but\nserves to enable future patches to introduce configuration variables\nto set pushremote_name.  For example, you can now do the following in\nhandle_config():\n\n    if (!strcmp(key, \"remote.pushdefault\"))\n       git_config_string(&pushremote_name, key, value);\n\nThen, pushes will automatically go to the remote specified by\nremote.pushdefault.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n builtin/push.c |  2 +-\n remote.c       | 25 +++++++++++++++++++++----\n remote.h       |  1 +\n 3 files changed, 23 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 5e4a0e9..909c34d 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -322,7 +322,7 @@ static int push_with_options(struct transport *transport, int flags)\n static int do_push(const char *repo, int flags)\n {\n \tint i, errs;\n-\tstruct remote *remote = remote_get(repo);\n+\tstruct remote *remote = pushremote_get(repo);\n \tconst char **url;\n \tint url_nr;\n \ndiff --git a/remote.c b/remote.c\nindex 34ddc5b..2b06e22 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -49,6 +49,7 @@ static int branches_nr;\n \n static struct branch *current_branch;\n static const char *default_remote_name;\n+static const char *pushremote_name;\n static int explicit_default_remote_name;\n \n static struct rewrites rewrites;\n@@ -670,17 +671,21 @@ static int valid_remote_nick(const char *name)\n \treturn !strchr(name, '/'); /* no slash */\n }\n \n-struct remote *remote_get(const char *name)\n+static struct remote *remote_get_1(const char *name, const char *pushremote_name)\n {\n \tstruct remote *ret;\n \tint name_given = 0;\n \n-\tread_config();\n \tif (name)\n \t\tname_given = 1;\n \telse {\n-\t\tname = default_remote_name;\n-\t\tname_given = explicit_default_remote_name;\n+\t\tif (pushremote_name) {\n+\t\t\tname = pushremote_name;\n+\t\t\tname_given = 1;\n+\t\t} else {\n+\t\t\tname = default_remote_name;\n+\t\t\tname_given = explicit_default_remote_name;\n+\t\t}\n \t}\n \n \tret = make_remote(name, 0);\n@@ -699,6 +704,18 @@ struct remote *remote_get(const char *name)\n \treturn ret;\n }\n \n+struct remote *remote_get(const char *name)\n+{\n+\tread_config();\n+\treturn remote_get_1(name, NULL);\n+}\n+\n+struct remote *pushremote_get(const char *name)\n+{\n+\tread_config();\n+\treturn remote_get_1(name, pushremote_name);\n+}\n+\n int remote_is_configured(const char *name)\n {\n \tint i;\ndiff --git a/remote.h b/remote.h\nindex 8743d6e..cf56724 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -51,6 +51,7 @@ struct remote {\n };\n \n struct remote *remote_get(const char *name);\n+struct remote *pushremote_get(const char *name);\n int remote_is_configured(const char *name);\n \n typedef int each_remote_fn(struct remote *remote, void *priv);\n-- \n1.8.2.363.g901f5bc\n"},{"id":"212854","messageId":"1364888434-30388-6-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 5/6] remote.c: introduce remote.pushdefault","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:33Z","receivedAt":"2013-04-02T07:40:33Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"This new configuration variable defines the default remote to push to,\nand overrides `branch.<name>.remote` for all branches.  It is useful\nin the typical triangular-workflow setup, where the remote you're\nfetching from is different from the remote you're pushing to.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n Documentation/config.txt | 13 ++++++++++---\n remote.c                 |  7 +++++++\n t/t5516-fetch-push.sh    | 12 ++++++++++++\n 3 files changed, 29 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex f79184c..9c6fd4a 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -727,9 +727,12 @@ branch.autosetuprebase::\n \tThis option defaults to never.\n \n branch.<name>.remote::\n-\tWhen in branch <name>, it tells 'git fetch' and 'git push' which\n-\tremote to fetch from/push to.  It defaults to `origin` if no remote is\n-\tconfigured. `origin` is also used if you are not on any branch.\n+\tWhen on branch <name>, it tells 'git fetch' and 'git push'\n+\twhich remote to fetch from/push to.  The remote to push to\n+\tmay be overridden with `remote.pushdefault` (for all branches).\n+\tIf no remote is configured, or if you are not on any branch,\n+\tit defaults to `origin` for fetching and `remote.pushdefault`\n+\tfor pushing.\n \n branch.<name>.merge::\n \tDefines, together with branch.<name>.remote, the upstream branch\n@@ -1898,6 +1901,10 @@ receive.updateserverinfo::\n \tIf set to true, git-receive-pack will run git-update-server-info\n \tafter receiving data from git-push and updating refs.\n \n+remote.pushdefault::\n+\tThe remote to push to by default.  Overrides\n+\t`branch.<name>.remote` for all branches.\n+\n remote.<name>.url::\n \tThe URL of a remote repository.  See linkgit:git-fetch[1] or\n \tlinkgit:git-push[1].\ndiff --git a/remote.c b/remote.c\nindex 2b06e22..6337e11 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -389,9 +389,16 @@ static int handle_config(const char *key, const char *value, void *cb)\n \t\t\tadd_instead_of(rewrite, xstrdup(value));\n \t\t}\n \t}\n+\n \tif (prefixcmp(key,  \"remote.\"))\n \t\treturn 0;\n \tname = key + 7;\n+\n+\t/* Handle remote.* variables */\n+\tif (!strcmp(name, \"pushdefault\"))\n+\t\treturn git_config_string(&pushremote_name, key, value);\n+\n+\t/* Handle remote.<name>.* variables */\n \tif (*name == '/') {\n \t\twarning(\"Config remote shorthand cannot begin with '/': %s\",\n \t\t\tname);\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex b800a8e..797b537 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -497,6 +497,18 @@ test_expect_success 'push with config remote.*.push = HEAD' '\n \tcheck_push_result testrepo $the_first_commit heads/local\n '\n \n+test_expect_success 'push with remote.pushdefault' '\n+\tmk_test up_repo heads/master &&\n+\tmk_test down_repo heads/master &&\n+\ttest_config remote.up.url up_repo &&\n+\ttest_config remote.down.url down_repo &&\n+\ttest_config branch.master.remote up &&\n+\ttest_config remote.pushdefault down &&\n+\tgit push &&\n+\tcheck_push_result up_repo $the_first_commit heads/master &&\n+\tcheck_push_result down_repo $the_commit heads/master\n+'\n+\n test_expect_success 'push with config remote.*.pushurl' '\n \n \tmk_test testrepo heads/master &&\n-- \n1.8.2.363.g901f5bc\n"},{"id":"212856","messageId":"1364888434-30388-7-git-send-email-artagnon@gmail.com","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"[PATCH 6/6] remote.c: introduce branch.<name>.pushremote","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2013-04-02T07:40:34Z","receivedAt":"2013-04-02T07:40:34Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"This new configuration variable overrides `remote.pushdefault` and\n`branch.<name>.remote` for pushes.  When you pull from one\nplace (e.g. your upstream) and push to another place (e.g. your own\npublishing repository), you would want to set `remote.pushdefault` to\nspecify the remote to push to for all branches, and use this option to\noverride it for a specific branch.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n Documentation/config.txt | 19 +++++++++++++++----\n remote.c                 |  4 ++++\n t/t5516-fetch-push.sh    | 15 +++++++++++++++\n 3 files changed, 34 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 9c6fd4a..3d750e0 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -730,9 +730,19 @@ branch.<name>.remote::\n \tWhen on branch <name>, it tells 'git fetch' and 'git push'\n \twhich remote to fetch from/push to.  The remote to push to\n \tmay be overridden with `remote.pushdefault` (for all branches).\n-\tIf no remote is configured, or if you are not on any branch,\n-\tit defaults to `origin` for fetching and `remote.pushdefault`\n-\tfor pushing.\n+\tThe remote to push to, for the current branch, may be further\n+\toverridden by `branch.<name>.pushremote`.  If no remote is\n+\tconfigured, or if you are not on any branch, it defaults to\n+\t`origin` for fetching and `remote.pushdefault` for pushing.\n+\n+branch.<name>.pushremote::\n+\tWhen on branch <name>, it overrides `branch.<name>.remote` for\n+\tpushing.  It also overrides `remote.pushdefault` for pushing\n+\tfrom branch <name>.  When you pull from one place (e.g. your\n+\tupstream) and push to another place (e.g. your own publishing\n+\trepository), you would want to set `remote.pushdefault` to\n+\tspecify the remote to push to for all branches, and use this\n+\toption to override it for a specific branch.\n \n branch.<name>.merge::\n \tDefines, together with branch.<name>.remote, the upstream branch\n@@ -1903,7 +1913,8 @@ receive.updateserverinfo::\n \n remote.pushdefault::\n \tThe remote to push to by default.  Overrides\n-\t`branch.<name>.remote` for all branches.\n+\t`branch.<name>.remote` for all branches, and is overridden by\n+\t`branch.<name>.pushremote` for specific branches.\n \n remote.<name>.url::\n \tThe URL of a remote repository.  See linkgit:git-fetch[1] or\ndiff --git a/remote.c b/remote.c\nindex 6337e11..68eb99b 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -364,6 +364,10 @@ static int handle_config(const char *key, const char *value, void *cb)\n \t\t\t\tdefault_remote_name = branch->remote_name;\n \t\t\t\texplicit_default_remote_name = 1;\n \t\t\t}\n+\t\t} else if (!strcmp(subkey, \".pushremote\")) {\n+\t\t\tif (branch == current_branch)\n+\t\t\t\tif (git_config_string(&pushremote_name, key, value))\n+\t\t\t\t\treturn -1;\n \t\t} else if (!strcmp(subkey, \".merge\")) {\n \t\t\tif (!value)\n \t\t\t\treturn config_error_nonbool(key);\ndiff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh\nindex 797b537..7bf1555 100755\n--- a/t/t5516-fetch-push.sh\n+++ b/t/t5516-fetch-push.sh\n@@ -519,6 +519,21 @@ test_expect_success 'push with config remote.*.pushurl' '\n \tcheck_push_result testrepo $the_commit heads/master\n '\n \n+test_expect_success 'push with config branch.*.pushremote' '\n+\tmk_test up_repo heads/master &&\n+\tmk_test side_repo heads/master &&\n+\tmk_test down_repo heads/master &&\n+\ttest_config remote.up.url up_repo &&\n+\ttest_config remote.pushdefault side_repo &&\n+\ttest_config remote.down.url down_repo &&\n+\ttest_config branch.master.remote up &&\n+\ttest_config branch.master.pushremote down &&\n+\tgit push &&\n+\tcheck_push_result up_repo $the_first_commit heads/master &&\n+\tcheck_push_result side_repo $the_first_commit heads/master &&\n+\tcheck_push_result down_repo $the_commit heads/master\n+'\n+\n test_expect_success 'push with dry-run' '\n \n \tmk_test testrepo heads/master &&\n-- \n1.8.2.363.g901f5bc\n"},{"id":"212877","messageId":"20130402135813.GA23828@sigill.intra.peff.net","threadId":"33347","inReplyTo":"1364888434-30388-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH 0/6] Re-roll rr/triangle","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-04-02T13:58:13Z","receivedAt":"2013-04-02T13:58:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 02, 2013 at 01:10:28PM +0530, Ramkumar Ramachandra wrote:\n\n> Jeff King (1):\n>   t5516 (fetch-push): drop implicit arguments from helper functions\n> \n> Ramkumar Ramachandra (5):\n>   remote.c: simplify a bit of code using git_config_string()\n>   t5516 (fetch-push): update test description\n>   remote.c: introduce a way to have different remotes for fetch/push\n>   remote.c: introduce remote.pushdefault\n>   remote.c: introduce branch.<name>.pushremote\n\nThanks; I didn't see any problems in this round.\n\n-Peff\n"},{"id":"212919","messageId":"7vobdwetaj.fsf@alter.siamese.dyndns.org","threadId":"33347","inReplyTo":"20130402135813.GA23828@sigill.intra.peff.net","subject":"Re: [PATCH 0/6] Re-roll rr/triangle","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-02T17:28:20Z","receivedAt":"2013-04-02T17:28:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Tue, Apr 02, 2013 at 01:10:28PM +0530, Ramkumar Ramachandra wrote:\n>\n>> Jeff King (1):\n>>   t5516 (fetch-push): drop implicit arguments from helper functions\n>> \n>> Ramkumar Ramachandra (5):\n>>   remote.c: simplify a bit of code using git_config_string()\n>>   t5516 (fetch-push): update test description\n>>   remote.c: introduce a way to have different remotes for fetch/push\n>>   remote.c: introduce remote.pushdefault\n>>   remote.c: introduce branch.<name>.pushremote\n>\n> Thanks; I didn't see any problems in this round.\n\nCan I turn that into 5 Reviewed-by's?\n"},{"id":"212928","messageId":"20130402175225.GE24698@sigill.intra.peff.net","threadId":"33347","inReplyTo":"7vobdwetaj.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/6] Re-roll rr/triangle","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-04-02T17:52:25Z","receivedAt":"2013-04-02T17:52:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 02, 2013 at 10:28:20AM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > On Tue, Apr 02, 2013 at 01:10:28PM +0530, Ramkumar Ramachandra wrote:\n> >\n> >> Jeff King (1):\n> >>   t5516 (fetch-push): drop implicit arguments from helper functions\n> >> \n> >> Ramkumar Ramachandra (5):\n> >>   remote.c: simplify a bit of code using git_config_string()\n> >>   t5516 (fetch-push): update test description\n> >>   remote.c: introduce a way to have different remotes for fetch/push\n> >>   remote.c: introduce remote.pushdefault\n> >>   remote.c: introduce branch.<name>.pushremote\n> >\n> > Thanks; I didn't see any problems in this round.\n> \n> Can I turn that into 5 Reviewed-by's?\n\nYes, please do. Six if you want me to review my own patch. :)\n\n-Peff\n"}]}