Merge branch 'js/maint-clone-insteadof'
authorJunio C Hamano <gitster@pobox.com>
Tue, 1 Jul 2008 23:22:22 +0000 (16:22 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 1 Jul 2008 23:22:22 +0000 (16:22 -0700)
* js/maint-clone-insteadof:
clone: respect the settings in $HOME/.gitconfig and /etc/gitconfig
clone: respect url.insteadOf setting in global configs

1  2 
builtin-clone.c
diff --combined builtin-clone.c
index f13845fb7f0c4b3759a3055fdfe216f83d18f957,e9ecb5d21a1629762188d0bb34c9de5d84053114..643c7d41697868456c94f879bd3357b91744f4db
@@@ -18,7 -18,6 +18,7 @@@
  #include "transport.h"
  #include "strbuf.h"
  #include "dir.h"
 +#include "pack-refs.h"
  
  /*
   * Overall FIXMEs:
@@@ -322,11 -321,8 +322,11 @@@ static struct ref *write_remote_refs(co
        get_fetch_map(refs, tag_refspec, &tail, 0);
  
        for (r = local_refs; r; r = r->next)
 -              update_ref(reflog,
 -                         r->peer_ref->name, r->old_sha1, NULL, 0, DIE_ON_ERR);
 +              add_extra_ref(r->peer_ref->name, r->old_sha1, 0);
 +
 +      pack_refs(PACK_REFS_ALL);
 +      clear_extra_refs();
 +
        return local_refs;
  }
  
@@@ -424,6 -420,13 +424,13 @@@ int cmd_clone(int argc, const char **ar
        fprintf(stderr, "Initialize %s\n", git_dir);
        init_db(option_template, option_quiet ? INIT_DB_QUIET : 0);
  
+       /*
+        * At this point, the config exists, so we do not need the
+        * environment variable.  We actually need to unset it, too, to
+        * re-enable parsing of the global configs.
+        */
+       unsetenv(CONFIG_ENVIRONMENT);
        if (option_reference)
                setup_reference(git_dir);
  
                refs = clone_local(path, git_dir);
        else {
                struct remote *remote = remote_get(argv[0]);
-               struct transport *transport = transport_get(remote, argv[0]);
+               struct transport *transport =
+                       transport_get(remote, remote->url[0]);
  
                if (!transport->get_refs_list || !transport->fetch)
                        die("Don't know how to clone %s", transport->url);