t9001: style modernisation phase #4
[gitweb.git] / transport-helper.c
index 2b24d51a24adb9dfc885591ceb1653ace65f198a..0224687a2316798c57315093315eafae0da0b1aa 100644 (file)
@@ -108,12 +108,6 @@ static struct child_process *get_helper(struct transport *transport)
        int refspec_alloc = 0;
        int duped;
        int code;
-       char git_dir_buf[sizeof(GIT_DIR_ENVIRONMENT) + PATH_MAX + 1];
-       const char *helper_env[] = {
-               git_dir_buf,
-               NULL
-       };
-
 
        if (data->helper)
                return data->helper;
@@ -129,8 +123,8 @@ static struct child_process *get_helper(struct transport *transport)
        helper->git_cmd = 0;
        helper->silent_exec_failure = 1;
 
-       snprintf(git_dir_buf, sizeof(git_dir_buf), "%s=%s", GIT_DIR_ENVIRONMENT, get_git_dir());
-       helper->env = helper_env;
+       argv_array_pushf(&helper->env_array, "%s=%s", GIT_DIR_ENVIRONMENT,
+                        get_git_dir());
 
        code = start_command(helper);
        if (code < 0 && errno == ENOENT)
@@ -420,7 +414,7 @@ static int get_exporter(struct transport *transport,
        struct child_process *helper = get_helper(transport);
        int i;
 
-       memset(fastexport, 0, sizeof(*fastexport));
+       child_process_init(fastexport);
 
        /* we need to duplicate helper->in because we want to use it after
         * fastexport is done with it. */
@@ -897,7 +891,10 @@ static int push_refs_with_export(struct transport *transport,
                                        int flag;
 
                                        /* Follow symbolic refs (mainly for HEAD). */
-                                       name = resolve_ref_unsafe(ref->peer_ref->name, sha1, 1, &flag);
+                                       name = resolve_ref_unsafe(
+                                                ref->peer_ref->name,
+                                                RESOLVE_REF_READING,
+                                                sha1, &flag);
                                        if (!name || !(flag & REF_ISSYMREF))
                                                name = ref->peer_ref->name;