This test verifies that the following expressions all evaluate to the full refname "refs/peers/origin/heads/master": - refs/peers/origin/heads/master - peers/origin/heads/master - origin/heads/master - origin/master (We assume that there are no other conflicting refs for which the above expressions would cause ambiguity.) Currently none of these work, because the refs machinery don't know how to expand shorthand names within the refs/peers/* hierarchy. Mirroring the expansion of the above 4 expressions into the full refname, the same 4 expressions should also be shortened into "origin/master" when abbreviating them into their shortest unambiguous representation, e.g. when running "git rev-parse --abbrev-ref" on them. A (currently failing) test verifying this behavior is also added by this patch. Signed-off-by: Johan Herland <johan@xxxxxxxxxxx> --- t/t7900-working-with-namespaced-remote-refs.sh | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/t/t7900-working-with-namespaced-remote-refs.sh b/t/t7900-working-with-namespaced-remote-refs.sh index dfd916b..109e9b8 100755 --- a/t/t7900-working-with-namespaced-remote-refs.sh +++ b/t/t7900-working-with-namespaced-remote-refs.sh @@ -79,4 +79,32 @@ test_expect_success 'work-around "clone" with namespaced remote refs' ' test_clone client ' +test_expect_success 'enter client repo' ' + cd client +' + +test_expect_failure 'short-hand notation expands correctly for remote-tracking branches' ' + echo refs/peers/origin/heads/master >expect && + git rev-parse --symbolic-full-name refs/peers/origin/heads/master >actual && + test_cmp expect actual && + git rev-parse --symbolic-full-name peers/origin/heads/master >actual && + test_cmp expect actual && + git rev-parse --symbolic-full-name origin/heads/master >actual && + test_cmp expect actual && + git rev-parse --symbolic-full-name origin/master >actual && + test_cmp expect actual +' + +test_expect_failure 'remote-tracking branches are shortened correctly' ' + echo origin/master >expect && + git rev-parse --abbrev-ref refs/peers/origin/heads/master >actual && + test_cmp expect actual && + git rev-parse --abbrev-ref peers/origin/heads/master >actual && + test_cmp expect actual && + git rev-parse --abbrev-ref origin/heads/master >actual && + test_cmp expect actual && + git rev-parse --abbrev-ref origin/master >actual && + test_cmp expect actual +' + test_done -- 1.8.1.3.704.g33f7d4f -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html