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

Re: [PATCH v2 2/2] t: Add test for cloning from ref namespace

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 5, 2015, 15:33 UTC
Message-ID
<xmqqk2vitbjh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1433513531-13423-3-git-send-email-johannes@kyriasis.com>
Johannes Löthberg <johannes@kyriasis.com> writes:
Show 6 quoted lines
> Test that the master ref is set up properly when cloning from a ref
> namespace
>
> Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
> ---
>  t/t9904-clone-from-ref-namespace.sh | 33 +++++++++++++++++++++++++++++++++

It seems that 5509 already has a few tests for namespaced transfer in both directions. Perhaps this new test would fit there better?

Also I think it probably is better to have these as a single patch.
Show 22 quoted lines
> diff --git a/t/t9904-clone-from-ref-namespace.sh b/t/t9904-clone-from-ref-namespace.sh
> new file mode 100755
> index 0000000..60977f8
> --- /dev/null
> +++ b/t/t9904-clone-from-ref-namespace.sh
> @@ -0,0 +1,33 @@
> +#!/bin/sh
> +#
> +
> +test_description='git clone from ref namespace
> +
> +This test checks that cloning from a ref namespace works'
> +
> +. ./test-lib.sh
> +
> +test_expect_success 'clone from ref namespace' '
> +	rm -rf initial bare clone &&
> +	git init initial &&
> +	git init --bare bare &&
> +	(
> +		cd initial &&
> +		echo "commit one" >> file &&
minor style: drop SP between redirection and its target, i.e.
		echo "commit one" >file &&
> +		git add file &&
> +		git commit -m "commit one" &&
> +		git push ../bare master &&

You want to make sure not just "push" does not complain, but that it left ../bare with the right result, i.e. something along the lines of

		git -C ../bare symbolic-ref HEAD >actual &&
		echo refs/heads/master >expect &&
                test_cmp expect actual &&
		git -C ../bare rev-parse HEAD >actual &&
                git rev-parse HEAD >expect &&
                test_cmp expect actual &&
> +		echo "commit two" >> file &&
Likewise on style.
> +		git add file &&
> +		git commit -m "commit two"
Broken &&-chain.
> +		GIT_NAMESPACE=new_namespace git push ../bare master
Likewise on checking the result of the push.
Show 5 quoted lines
> +	) &&
> +	GIT_NAMESPACE=new_namespace git clone bare clone &&
> +	(
> +		cd clone &&
> +		git show

Likewise on checking the result of the clone; not just it has HEAD to cause "show" to succeed, you would want it shows the right commit (i.e. not "one", but "two"). There may be other things you may want to check, too.

> +	)
> +'
> +
> +test_done
Previous: Johannes LöthbergNext: Johannes Löthberg
Message 9 of 22 in “receive-pack: Create a HEAD ref for ref namespace”
  1. receive-pack: Create a HEAD ref for ref namespaceJohannes Löthberg, Jun 1, 2015
  2. Johannes LöthbergJun 5, 2015
  3. Michael J GruberJun 5, 2015
  4. Johannes LöthbergJun 5, 2015
  5. Johannes LöthbergJun 5, 2015
  6. Fix cloning from ref namespaceJohannes Löthberg, Jun 5, 2015
  7. 1/2 receive-pack: Create a HEAD ref for ref namespaceJohannes Löthberg, Jun 5, 2015
  8. 2/2 t: Add test for cloning from ref namespaceJohannes Löthberg, Jun 5, 2015
  9. Junio C HamanoJun 5, 2015
  10. Johannes LöthbergJun 5, 2015
  11. Junio C HamanoJun 5, 2015
  12. Johannes LöthbergJun 5, 2015
  13. Johannes LöthbergJun 5, 2015
  14. Junio C HamanoJun 5, 2015
  15. receive-pack: Create a HEAD ref for ref namespaceJohannes Löthberg, Jun 5, 2015
  16. Johannes LöthbergJun 5, 2015
  17. Junio C HamanoJun 5, 2015
  18. Johannes LöthbergJun 5, 2015
  19. receive-pack: Create a HEAD ref for ref namespaceJohannes Löthberg, Jun 5, 2015
  20. Johannes LöthbergJun 10, 2015
  21. Junio C HamanoJun 15, 2015
  22. Johannes LöthbergJun 15, 2015

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.