diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Answer dumb-clone HEAD from the ref store
A reftable repository keeps only a placeholder in its HEAD file, so a dumb clone was told HEAD named refs/heads/.invalid and checked nothing out. HEAD is now answered the way git's http-backend answers it.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0303-robustness.sh26
1 file changed, 26 insertions, 0 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index da5e209..14bdca7 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -590,6 +590,32 @@ test_expect_success 'the dumb transport withholds the alternates file' '
grep "^Status: 200" tmp
'
+# A reftable repository keeps only a placeholder in its HEAD file, so the
+# branch a client is to check out has to come from the refs instead.
+test_expect_success 'the dumb transport answers HEAD from the refs' '
+ robq "url=rob/HEAD" >tmp &&
+ grep "^Status: 200" tmp &&
+ strip_headers <tmp >head &&
+ echo "ref: refs/heads/master" >expect &&
+ test_cmp expect head &&
+ git init -q --bare --ref-format=reftable -b trunk rt.git &&
+ git -C repos/rob push -q "$PWD/rt.git" master:trunk &&
+ {
+ echo "virtual-root=/" &&
+ echo "cache-size=0" &&
+ echo "repo.url=rt" &&
+ echo "repo.path=$PWD/rt.git"
+ } >rtrc &&
+ CGIT_CONFIG="$PWD/rtrc" QUERY_STRING="url=rt/HEAD" cgit >tmp &&
+ strip_headers <tmp >head &&
+ echo "ref: refs/heads/trunk" >expect &&
+ test_cmp expect head &&
+ CGIT_CONFIG="$PWD/emptyrc" QUERY_STRING="url=empty/HEAD" cgit >tmp &&
+ strip_headers <tmp >head &&
+ echo "ref: refs/heads/master" >expect &&
+ test_cmp expect head
+'
+
# A client that goes away mid-page leaves nobody to send an error page to,
# so the request ends quietly instead of dying twice into the log. The page
# has to outgrow the pipe for the write after the reader has gone to fail.