Make git-clone respect branch.autosetuprebase
[gitweb.git] / builtin-clone.c
index f73029e2ba285bfb20bce1760cef711f7a55fd02..a5f000adf456e8faee97c9db0e54713c0b4b3330 100644 (file)
@@ -20,6 +20,7 @@
 #include "dir.h"
 #include "pack-refs.h"
 #include "sigchain.h"
+#include "branch.h"
 
 /*
  * Overall FIXMEs:
@@ -539,6 +540,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                head_points_at = NULL;
                remote_head = NULL;
                option_no_checkout = 1;
+               if (!option_bare)
+                       install_branch_config(0, "master", option_origin,
+                                             "refs/heads/master");
        }
 
        if (head_points_at) {
@@ -567,11 +571,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
                                      head_points_at->peer_ref->name,
                                      reflog_msg.buf);
 
-                       strbuf_addf(&key, "branch.%s.remote", head);
-                       git_config_set(key.buf, option_origin);
-                       strbuf_reset(&key);
-                       strbuf_addf(&key, "branch.%s.merge", head);
-                       git_config_set(key.buf, head_points_at->name);
+                       install_branch_config(0, head, option_origin,
+                                             head_points_at->name);
                }
        } else if (remote_head) {
                /* Source had detached HEAD pointing somewhere. */