Merge branch 'jk/clone-progress-to-stderr' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 28 Oct 2013 17:19:24 +0000 (10:19 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Oct 2013 17:19:24 +0000 (10:19 -0700)
"git clone" gave some progress messages to the standard output, not to
the standard error, and did not allow suppressing them with the
"--no-progress" option.

* jk/clone-progress-to-stderr:
clone: always set transport options
clone: treat "checking connectivity" like other progress
clone: send diagnostic messages to stderr

1  2 
builtin/clone.c
diff --combined builtin/clone.c
index 21ad9f945c019625ace5f5dba0d4e54a8b2bb70f,63f298be9c991e50e476f21cdbbc333d849a734a..552f3409e3056846b45c6f300661dc5c14302b0b
@@@ -380,7 -380,7 +380,7 @@@ static void clone_local(const char *src
        }
  
        if (0 <= option_verbosity)
-               printf(_("done.\n"));
+               fprintf(stderr, _("done.\n"));
  }
  
  static const char *junk_work_tree;
@@@ -551,13 -551,13 +551,13 @@@ static void update_remote_refs(const st
        const struct ref *rm = mapped_refs;
  
        if (check_connectivity) {
-               if (0 <= option_verbosity)
-                       printf(_("Checking connectivity... "));
+               if (transport->progress)
+                       fprintf(stderr, _("Checking connectivity... "));
                if (check_everything_connected_with_transport(iterate_ref_map,
                                                              0, &rm, transport))
                        die(_("remote did not send all necessary objects"));
-               if (0 <= option_verbosity)
-                       printf(_("done\n"));
+               if (transport->progress)
+                       fprintf(stderr, _("done\n"));
        }
  
        if (refs) {
@@@ -850,9 -850,9 +850,9 @@@ int cmd_clone(int argc, const char **ar
  
        if (0 <= option_verbosity) {
                if (option_bare)
-                       printf(_("Cloning into bare repository '%s'...\n"), dir);
+                       fprintf(stderr, _("Cloning into bare repository '%s'...\n"), dir);
                else
-                       printf(_("Cloning into '%s'...\n"), dir);
+                       fprintf(stderr, _("Cloning into '%s'...\n"), dir);
        }
        init_db(option_template, INIT_DB_QUIET);
        write_config(&option_config);
        remote = remote_get(option_origin);
        transport = transport_get(remote, remote->url[0]);
  
-       if (!is_local) {
-               if (!transport->get_refs_list || !transport->fetch)
-                       die(_("Don't know how to clone %s"), transport->url);
+       if (!transport->get_refs_list || (!is_local && !transport->fetch))
+               die(_("Don't know how to clone %s"), transport->url);
  
-               transport_set_option(transport, TRANS_OPT_KEEP, "yes");
+       transport_set_option(transport, TRANS_OPT_KEEP, "yes");
  
-               if (option_depth)
-                       transport_set_option(transport, TRANS_OPT_DEPTH,
-                                            option_depth);
-               if (option_single_branch)
-                       transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
+       if (option_depth)
+               transport_set_option(transport, TRANS_OPT_DEPTH,
+                                    option_depth);
+       if (option_single_branch)
+               transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1");
  
-               transport_set_verbosity(transport, option_verbosity, option_progress);
+       transport_set_verbosity(transport, option_verbosity, option_progress);
  
-               if (option_upload_pack)
-                       transport_set_option(transport, TRANS_OPT_UPLOADPACK,
-                                            option_upload_pack);
+       if (option_upload_pack)
+               transport_set_option(transport, TRANS_OPT_UPLOADPACK,
+                                    option_upload_pack);
  
-               if (transport->smart_options && !option_depth)
-                       transport->smart_options->check_self_contained_and_connected = 1;
-       }
+       if (transport->smart_options && !option_depth)
+               transport->smart_options->check_self_contained_and_connected = 1;
  
        refs = transport_get_remote_refs(transport);
  
                        our_head_points_at = remote_head_points_at;
        }
        else {
 +              if (option_branch)
 +                      die(_("Remote branch %s not found in upstream %s"),
 +                                      option_branch, option_origin);
 +
                warning(_("You appear to have cloned an empty repository."));
                mapped_refs = NULL;
                our_head_points_at = NULL;