3 test_description
='test fetching of oddly-named refs'
4 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
5 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9 # afterwards we will have:
11 # refs/for/refs/heads/main - one
12 # refs/heads/main - three
13 test_expect_success
'setup repo with odd suffix ref' '
17 git update-ref refs/for/refs/heads/main HEAD &&
18 echo content >>file &&
19 git commit -a -m two &&
20 echo content >>file &&
21 git commit -a -m three &&
25 test_expect_success
'suffix ref is ignored during fetch' '
26 git clone --bare file://"$PWD" suffix &&
28 git --git-dir=suffix log -1 --format=%s refs/heads/main >actual &&
29 test_cmp expect actual
32 test_expect_success
'try to create repo with absurdly long refname' '
33 ref240=$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID/$ZERO_OID &&
34 ref1440=$ref240/$ref240/$ref240/$ref240/$ref240/$ref240 &&
41 if git -C long update-ref refs/heads/$ref1440 long; then
42 test_set_prereq LONG_REF
44 echo >&2 "long refs not supported"
48 test_expect_success LONG_REF
'fetch handles extremely long refname' '
49 git fetch long refs/heads/*:refs/remotes/long/* &&
50 cat >expect <<-\EOF &&
54 git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
55 test_cmp expect actual
58 test_expect_success LONG_REF
'push handles extremely long refname' '
59 git push long :refs/heads/$ref1440 &&
60 git -C long for-each-ref --format="%(subject)" refs/heads >actual &&
62 test_cmp expect actual