Merge branch 'mm/am-c-doc' into maint
[gitweb.git] / t / t5527-fetch-odd-refs.sh
index edea9f957e4034098faeb51dec59e9661af8e29e..207899a99faa4ff8fb4d7226e930ba1e9803dc74 100755 (executable)
@@ -26,4 +26,37 @@ test_expect_success 'suffix ref is ignored during fetch' '
        test_cmp expect actual
 '
 
+test_expect_success 'try to create repo with absurdly long refname' '
+       ref240=$_z40/$_z40/$_z40/$_z40/$_z40/$_z40 &&
+       ref1440=$ref240/$ref240/$ref240/$ref240/$ref240/$ref240 &&
+       git init long &&
+       (
+               cd long &&
+               test_commit long &&
+               test_commit master
+       ) &&
+       if git -C long update-ref refs/heads/$ref1440 long; then
+               test_set_prereq LONG_REF
+       else
+               echo >&2 "long refs not supported"
+       fi
+'
+
+test_expect_success LONG_REF 'fetch handles extremely long refname' '
+       git fetch long refs/heads/*:refs/remotes/long/* &&
+       cat >expect <<-\EOF &&
+       long
+       master
+       EOF
+       git for-each-ref --format="%(subject)" refs/remotes/long >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success LONG_REF 'push handles extremely long refname' '
+       git push long :refs/heads/$ref1440 &&
+       git -C long for-each-ref --format="%(subject)" refs/heads >actual &&
+       echo master >expect &&
+       test_cmp expect actual
+'
+
 test_done