Code

Merge branch 'db/push-cleanup'
[git.git] / builtin-fetch.c
index f3bdeda05994179dcd564e4a2ae758ca0d2c23a0..3c998ea740adf474ee980fc763bd7156b9ce81af 100644 (file)
@@ -540,7 +540,8 @@ static void check_not_current_branch(struct ref *ref_map)
        for (; ref_map; ref_map = ref_map->next)
                if (ref_map->peer_ref && !strcmp(current_branch->refname,
                                        ref_map->peer_ref->name))
-                       die("Refusing to fetch into current branch");
+                       die("Refusing to fetch into current branch %s "
+                           "of non-bare repository", current_branch->refname);
 }
 
 static int do_fetch(struct transport *transport,
@@ -632,6 +633,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;
@@ -644,9 +648,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 *));