public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Johannes Löthberg" <johannes@kyriasis•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v3] receive-pack: Create a HEAD ref for ref namespace
Date: Fri, 05 Jun 2015 10:19:32 -0700	[thread overview]
Message-ID: <xmqqh9qmrs2j.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1433523731-25172-1-git-send-email-johannes@kyriasis.com> ("Johannes Löthberg"'s message of "Fri, 5 Jun 2015 19:02:11 +0200")

Johannes Löthberg <johannes@kyriasis•com> writes:

> diff --git a/t/t5509-fetch-push-namespaces.sh b/t/t5509-fetch-push-namespaces.sh
> index cc0b31f..7bc3a1f 100755
> --- a/t/t5509-fetch-push-namespaces.sh
> +++ b/t/t5509-fetch-push-namespaces.sh
> @@ -1,6 +1,7 @@
>  #!/bin/sh
>  
> -test_description='fetch/push involving ref namespaces'
> +test_description='fetch/push/clone involving ref namespaces'
> +

OK ;-)

>  . ./test-lib.sh
>  
>  test_expect_success setup '
> @@ -82,4 +83,50 @@ test_expect_success 'mirroring a repository using a ref namespace' '
>  	)
>  '
>  
> +test_expect_success 'cloning from ref namespace' '
> +	rm -rf initial bare clone &&
> +	git init initial &&
> +	git init --bare bare &&
> +	(
> +		cd initial &&
> +		echo "commit one" >file &&
> +		git add file &&
> +		git commit -m "commit one" &&
> +		git push ../bare master &&
> +
> +		echo refs/heads/master >expect &&
> +		git -C ../bare symbolic-ref HEAD >actual &&
> +		test_cmp expect actual &&
> +
> +		git rev-parse HEAD >expect &&
> +		git -C ../bare rev-parse HEAD >actual &&
> +		test_cmp expect actual &&
> +
> +		echo "commit two" >>file &&
> +		git add file &&
> +		git commit -m "commit two" &&
> +		GIT_NAMESPACE=new_namespace git push ../bare master &&
> +
> +		echo "ref: refs/namespaces/new_namespace/refs/heads/master" >expect &&
> +		test_cmp expect ../bare/refs/namespaces/new_namespace/HEAD  &&

Use "symbolic-ref refs/namespaces/new_namespace/HEAD"; HEAD is not
required to be expressed as a textual symref.

> +
> +		(
> +			printf "%s commit\t%s\n" $(git rev-parse master^) \
> +			                         refs/heads/master &&
> +			printf "%s commit\t%s\n" $(git rev-parse master) \
> +			                         refs/namespaces/new_namespace/HEAD &&
> +			printf "%s commit\t%s\n" $(git rev-parse master) \
> +			                         refs/namespaces/new_namespace/refs/heads/master
> +		) >expect &&

Use of 'printf' is clever and I like it.  Have you considered
letting it do the iteration as well?  I.e.

	printf "%s commit\t%s\n" \
        	one two \
                three four \
                five six \
	>expect &&

might be easier to read.

> +		git -C ../bare for-each-ref refs/ >actual &&
> +		test_cmp expect actual
> +	) &&
> +	GIT_NAMESPACE=new_namespace git clone bare clone &&
> +	(
> +		cd clone &&
> +		git show

We can accept any random commit at HEAD as long as it exists at this
point?  Don't we need to make sure that a ref whose tip is still "one"
is not propagated to this new clone?

> +	)
> +'
> +
> +
>  test_done

  parent reply	other threads:[~2015-06-05 17:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 21:24 [PATCH] receive-pack: Create a HEAD ref for ref namespace Johannes Löthberg
2015-06-05 11:53 ` Johannes Löthberg
2015-06-05 12:55   ` Michael J Gruber
2015-06-05 13:50     ` Johannes Löthberg
2015-06-05 14:10     ` Johannes Löthberg
2015-06-05 14:12 ` [PATCH v2] Fix cloning from " Johannes Löthberg
2015-06-05 14:12   ` [PATCH v2 1/2] receive-pack: Create a HEAD ref for " Johannes Löthberg
2015-06-05 14:12   ` [PATCH v2 2/2] t: Add test for cloning from " Johannes Löthberg
2015-06-05 15:33     ` Junio C Hamano
2015-06-05 16:12       ` Johannes Löthberg
2015-06-05 16:22         ` Junio C Hamano
2015-06-05 16:31           ` Johannes Löthberg
2015-06-05 16:25         ` Johannes Löthberg
2015-06-05 16:46           ` Junio C Hamano
2015-06-05 17:02 ` [PATCH v3] receive-pack: Create a HEAD ref for " Johannes Löthberg
2015-06-05 17:08   ` Johannes Löthberg
2015-06-05 17:19   ` Junio C Hamano [this message]
2015-06-05 17:27     ` Johannes Löthberg
2015-06-05 17:42 ` [PATCH v4] " Johannes Löthberg
2015-06-10 23:39   ` Johannes Löthberg
2015-06-15 20:48   ` Junio C Hamano
2015-06-15 20:59     ` Johannes Löthberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqh9qmrs2j.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=johannes@kyriasis$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox