Re: [PATCH v2 2/2] t: Add test for cloning from ref namespace
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 5, 2015, 16:22 UTC
- Message-ID
- <xmqq7frit9ad.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20150605161225.GA23368@leeloo.kyriasis.com>
Johannes Löthberg <johannes@kyriasis.com> 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 actualor 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 actualmight be a more appropriate test.