Merge branch 'mv/clonev'
authorJunio C Hamano <gitster@pobox.com>
Sun, 19 Oct 2008 23:07:07 +0000 (16:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 19 Oct 2008 23:07:07 +0000 (16:07 -0700)
* mv/clonev:
Implement git clone -v

1  2 
builtin-clone.c
diff --combined builtin-clone.c
index 1ddc14b9c70b3318ab5e1cad779c8af029e56ce3,df71b2381066fa1747bb4afa64e7e7560547ef22..8e1a1d399580af3faa39c3c50350b3ca19df0634
@@@ -38,9 -38,11 +38,11 @@@ static int option_local, option_no_hard
  static char *option_template, *option_reference, *option_depth;
  static char *option_origin = NULL;
  static char *option_upload_pack = "git-upload-pack";
+ static int option_verbose;
  
  static struct option builtin_clone_options[] = {
        OPT__QUIET(&option_quiet),
+       OPT__VERBOSE(&option_verbose),
        OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
                    "don't create a checkout"),
        OPT_BOOLEAN(0, "bare", &option_bare, "create a bare repository"),
@@@ -264,9 -266,10 +266,9 @@@ pid_t junk_pid
  
  static void remove_junk(void)
  {
 -      struct strbuf sb;
 +      struct strbuf sb = STRBUF_INIT;
        if (getpid() != junk_pid)
                return;
 -      strbuf_init(&sb, 0);
        if (junk_git_dir) {
                strbuf_addstr(&sb, junk_git_dir);
                remove_dir_recursively(&sb, 0);
@@@ -353,7 -356,7 +355,7 @@@ int cmd_clone(int argc, const char **ar
        char *path, *dir;
        const struct ref *refs, *head_points_at, *remote_head, *mapped_refs;
        char branch_top[256], key[256], value[256];
 -      struct strbuf reflog_msg;
 +      struct strbuf reflog_msg = STRBUF_INIT;
        struct transport *transport = NULL;
        char *src_ref_prefix = "refs/heads/";
  
        if (!stat(dir, &buf))
                die("destination directory '%s' already exists.", dir);
  
 -      strbuf_init(&reflog_msg, 0);
        strbuf_addf(&reflog_msg, "clone: from %s", repo);
  
        if (option_bare)
  
                if (option_quiet)
                        transport->verbose = -1;
+               else if (option_verbose)
+                       transport->progress = 1;
  
                if (option_upload_pack)
                        transport_set_option(transport, TRANS_OPT_UPLOADPACK,
                create_symref("HEAD", head_points_at->name, NULL);
  
                if (!option_bare) {
 -                      struct strbuf head_ref;
 +                      struct strbuf head_ref = STRBUF_INIT;
                        const char *head = head_points_at->name;
  
                        if (!prefixcmp(head, "refs/heads/"))
                                   head_points_at->old_sha1,
                                   NULL, 0, DIE_ON_ERR);
  
 -                      strbuf_init(&head_ref, 0);
                        strbuf_addstr(&head_ref, branch_top);
                        strbuf_addstr(&head_ref, "HEAD");