Code

Give error when no remote is configured
[git.git] / builtin-fetch.c
index 1e4a3d9c516c88d701819b7f4b73c722412d540f..7fb35fca9d1b57dacaebfd3cb9b2af4d035e750c 100644 (file)
@@ -636,6 +636,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        else
                remote = remote_get(argv[0]);
 
+       if (!remote)
+               die("Where do you want to fetch from today?");
+
        transport = transport_get(remote, remote->url[0]);
        if (verbosity >= 2)
                transport->verbose = 1;
@@ -648,9 +651,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
        if (depth)
                set_option(TRANS_OPT_DEPTH, depth);
 
-       if (!transport->url)
-               die("Where do you want to fetch from today?");
-
        if (argc > 1) {
                int j = 0;
                refs = xcalloc(argc + 1, sizeof(const char *));