Merge branch 'master' of git://repo.or.cz/git-gui
[gitweb.git] / builtin-init-db.c
index 8e7540b6922696fb8100879eb9c4acf587f004db..4df9fd0fad7bbc3fd0cde1e6e57b902fbd277608 100644 (file)
@@ -231,7 +231,7 @@ static int create_default_files(const char *git_dir, const char *template_path)
        strcpy(path + len, "HEAD");
        reinit = !read_ref("HEAD", sha1);
        if (!reinit) {
-               if (create_symref("HEAD", "refs/heads/master") < 0)
+               if (create_symref("HEAD", "refs/heads/master", NULL) < 0)
                        exit(1);
        }
 
@@ -257,7 +257,9 @@ static int create_default_files(const char *git_dir, const char *template_path)
        }
        else {
                git_config_set("core.bare", "false");
-               git_config_set("core.logallrefupdates", "true");
+               /* allow template config file to override the default */
+               if (log_all_ref_updates == -1)
+                   git_config_set("core.logallrefupdates", "true");
        }
        return reinit;
 }
@@ -281,11 +283,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 
        for (i = 1; i < argc; i++, argv++) {
                const char *arg = argv[1];
-               if (!strncmp(arg, "--template=", 11))
+               if (!prefixcmp(arg, "--template="))
                        template_dir = arg+11;
                else if (!strcmp(arg, "--shared"))
                        shared_repository = PERM_GROUP;
-               else if (!strncmp(arg, "--shared=", 9))
+               else if (!prefixcmp(arg, "--shared="))
                        shared_repository = git_config_perm("arg", arg+9);
                else
                        usage(init_db_usage);