git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC] add test cases for the --repo option to git push

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2009, 21:58 UTC
Message-ID
<7vhc2iyy9y.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1235497240-20677-1-git-send-email-git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 27 quoted lines
> @@ -419,6 +419,41 @@ test_expect_success 'push with config remote.*.push = HEAD' '
>  git config --remove-section remote.there
>  git config --remove-section branch.master
>  
> +test_expect_success 'push with --repo=repourl from non-tracking branch' '
> +
> +	mk_test heads/master &&
> +	git push --repo=testrepo &&
> +	check_push_result $the_commit heads/master
> +'
> +
> +# set up fake remote config
> +test_expect_success 'push with --repo=remoterepo from non-tracking branch' '
> +
> +	mk_test heads/master &&
> +	git config remote.testremote.url testrepo &&
> +	git push --repo=testremote &&
> +	check_push_result $the_commit heads/master
> +'
> +
> +# set up fake tracking info; testrepo exists, origin does not.
> +test_expect_failure 'push with --repo=repo from tracking branch with bad config' '
> +
> +	mk_test heads/master &&
> +	git config branch.master.remote origin &&
> +	test_must_fail git push --repo=testrepo
> +'
At this point, you have:
	branch.master.remote = origin
        remote.testremote.url = testrepo

and nothing else related to push. And you are asking a "git push but instead of origin please default to testrepo".

In response to that request, in order to figure out what refs to push by default, remote.testremote.push instead of remote.origin.push will be consulted, and we won't even have to notice nor complain the missing remote.origin. remote.testremote.push is missing, so the push defaults to the "matching ref" behaviour.

I do not understand why you expect the above to fail.
Show 7 quoted lines
> +test_expect_failure 'push with --repo=repo from tracking branch with good config' '
> +
> +	mk_test heads/master &&
> +	git config branch.master.remote testrepo &&
> +	git push --repo=origin &&
> +	check_push_result $the_commit heads/master
> +'
Likewise.

I think the "good/bad config" labels given to your two test scripts are swapped and there is no bug or misfeature here.

Previous: Michael J GruberNext: Michael J Gruber
Message 4 of 13 in “git push usage”
  1. Jay SoffianFeb 20, 2009
  2. Jay SoffianFeb 21, 2009
  3. [RFC] add test cases for the --repo option to git pushMichael J Gruber, Feb 24, 2009
  4. Junio C HamanoFeb 25, 2009
  5. Michael J GruberFeb 26, 2009
  6. Junio C HamanoFeb 26, 2009
  7. Michael J GruberFeb 26, 2009
  8. Jay SoffianFeb 26, 2009
  9. Michael J GruberFeb 27, 2009
  10. Junio C HamanoFeb 27, 2009
  11. Jay SoffianFeb 27, 2009
  12. Linus TorvaldsFeb 27, 2009
  13. Jay SoffianFeb 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.