On 05/06, Junio C Hamano wrote:
Johannes Löthberg <[email protected]> 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 ref namespace has its own HEAD, so I'd expect GIT_NAMESPACE=foo git rev-parse HEAD to act sensibly
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.
Sounds okay. -- Sincerely, Johannes Löthberg PGP Key ID: 0x50FB9B273A9D0BB5 https://theos.kyriasis.com/~kyrias/
signature.asc
Description: PGP signature

