summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/run-command.c b/run-command.c
index f5e1149f9b..9b3a57d1e3 100644
--- a/run-command.c
+++ b/run-command.c
@@ -421,12 +421,12 @@ static int prepare_cmd(struct argv_array *out, const struct child_process *cmd)
}
/*
- * If there are no '/' characters in the command then perform a path
- * lookup and use the resolved path as the command to exec. If there
- * are '/' characters, we have exec attempt to invoke the command
- * directly.
+ * If there are no dir separator characters in the command then perform
+ * a path lookup and use the resolved path as the command to exec. If
+ * there are dir separator characters, we have exec attempt to invoke
+ * the command directly.
*/
- if (!strchr(out->argv[1], '/')) {
+ if (!has_dir_sep(out->argv[1])) {
char *program = locate_in_PATH(out->argv[1]);
if (program) {
free((char *)out->argv[1]);
@@ -1864,3 +1864,16 @@ int run_processes_parallel_tr2(int n, get_next_task_fn get_next_task,
return result;
}
+
+int run_auto_gc(int quiet)
+{
+ struct argv_array argv_gc_auto = ARGV_ARRAY_INIT;
+ int status;
+
+ argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
+ if (quiet)
+ argv_array_push(&argv_gc_auto, "--quiet");
+ status = run_command_v_opt(argv_gc_auto.argv, RUN_GIT_CMD);
+ argv_array_clear(&argv_gc_auto);
+ return status;
+}