tests: add a special setup where prerequisites fail
[gitweb.git] / t / t5550-http-fetch-dumb.sh
index 6d7d88ccc906a4c73285550ec80cd3fe67a764ee..b811d89cfd6df25fb2e42db6f05a69cf0b7a6c3b 100755 (executable)
@@ -408,5 +408,20 @@ test_expect_success 'print HTTP error when any intermediate redirect throws erro
        test_i18ngrep "unable to access.*/redir-to/502" stderr
 '
 
-stop_httpd
+test_expect_success 'fetching via http alternates works' '
+       parent=$HTTPD_DOCUMENT_ROOT_PATH/alt-parent.git &&
+       git init --bare "$parent" &&
+       git -C "$parent" --work-tree=. commit --allow-empty -m foo &&
+       git -C "$parent" update-server-info &&
+       commit=$(git -C "$parent" rev-parse HEAD) &&
+
+       child=$HTTPD_DOCUMENT_ROOT_PATH/alt-child.git &&
+       git init --bare "$child" &&
+       echo "../../alt-parent.git/objects" >"$child/objects/info/alternates" &&
+       git -C "$child" update-ref HEAD $commit &&
+       git -C "$child" update-server-info &&
+
+       git -c http.followredirects=true clone "$HTTPD_URL/dumb/alt-child.git"
+'
+
 test_done