]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t5553: use local url for invalid fetch
authorJeff King <peff@peff.net>
Wed, 26 Jun 2024 20:54:28 +0000 (16:54 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Jun 2024 21:31:17 +0000 (14:31 -0700)
We test how "fetch --set-upstream" behaves when given an invalid URL,
using the bogus URL "http://nosuchdomain.example.com". But finding out
that it is invalid requires an actual DNS lookup.

Reduce our dependency on external factors by using an invalid local
filesystem URL, which works just as well for our purposes.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5553-set-upstream.sh

index 48050162c27440dab8a0dbc5cd19a2781bee2d37..70e3376d31b4311764be51360acd86447e885a31 100755 (executable)
@@ -73,10 +73,10 @@ test_expect_success 'fetch --set-upstream main:other does not set the branch oth
        check_config_missing other2
 '
 
-test_expect_success 'fetch --set-upstream http://nosuchdomain.example.com fails with invalid url' '
+test_expect_success 'fetch --set-upstream ./does-not-exist fails with invalid url' '
        # main explicitly not cleared, we check that it is not touched from previous value
        clear_config other other2 &&
-       test_must_fail git fetch --set-upstream http://nosuchdomain.example.com &&
+       test_must_fail git fetch --set-upstream ./does-not-exist &&
        check_config main upstream refs/heads/other &&
        check_config_missing other &&
        check_config_missing other2
@@ -143,10 +143,10 @@ test_expect_success 'pull --set-upstream upstream tag does not set the tag' '
        check_config_missing three
 '
 
-test_expect_success 'pull --set-upstream http://nosuchdomain.example.com fails with invalid url' '
+test_expect_success 'pull --set-upstream ./does-not-exist fails with invalid url' '
        # main explicitly not cleared, we check that it is not touched from previous value
        clear_config other other2 three &&
-       test_must_fail git pull --set-upstream http://nosuchdomain.example.com &&
+       test_must_fail git pull --set-upstream ./does-not-exist &&
        check_config main upstream refs/heads/other &&
        check_config_missing other &&
        check_config_missing other2 &&