transport.c: introduce core.alternateRefsCommand
[git/git.git] / transport.c
index 25d8ea7..19baec7 100644 (file)
@@ -1328,10 +1328,21 @@ literal_copy:
 static void fill_alternate_refs_command(struct child_process *cmd,
                                        const char *repo_path)
 {
-       cmd->git_cmd = 1;
-       argv_array_pushf(&cmd->args, "--git-dir=%s", repo_path);
-       argv_array_push(&cmd->args, "for-each-ref");
-       argv_array_push(&cmd->args, "--format=%(objectname)");
+       const char *value;
+
+       if (!git_config_get_value("core.alternateRefsCommand", &value)) {
+               cmd->use_shell = 1;
+
+               argv_array_push(&cmd->args, value);
+               argv_array_push(&cmd->args, repo_path);
+       } else {
+               cmd->git_cmd = 1;
+
+               argv_array_pushf(&cmd->args, "--git-dir=%s", repo_path);
+               argv_array_push(&cmd->args, "for-each-ref");
+               argv_array_push(&cmd->args, "--format=%(objectname)");
+       }
+
        cmd->env = local_repo_env;
        cmd->out = -1;
 }