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

From: Junio C Hamano <[email-masked]>
Date: Fri, 05 Jun 2015 09:22:18 -0700

Johannes Löthberg <[email-masked]> writes:

> Hmm, it seems that git-rev-parse doesn't handle GIT_NAMESPACE yet, so
> can't check it for the namespaced push right now. Not sure if I can
> fix that myself though.

I do not see a need for rev-parse to pay attention to GIT_NAMESPACE
at all, though.

The destination that accepts the push with the enviornment variable,
i.e. your ../bare repository after this:

+		git commit -m "commit two"
+		GIT_NAMESPACE=new_namespace git push ../bare master

must be saving the result somewhere in ../bare/, and that is what
you want to check (and also no refs are affected outside that
hierarchy).

So perhaps along the lines of

        echo $(git rev-parse master) commit \
        	refs/namespaces/new_namespace/refs/heads/master >expect &&
	git -C ../bare for-each-ref refs/namespaces/ >actual &&
	test_cmp expect actual

or something?  You would want to also check that other refs are not
molested, so

	(
        	echo $(git rev-parse master^) commit \
                	refs/heads/master &&
	        echo $(git rev-parse master) commit \
	        	refs/namespaces/new_namespace/refs/heads/master
	) >expect &&
	git -C ../bare for-each-ref >actual &&
	test_cmp expect actual

might be a more appropriate test.