]> git.ipfire.org Git - thirdparty/git.git/blobdiff - run-command.c
Merge branch 'cm/rebase-i-updates'
[thirdparty/git.git] / run-command.c
index 8c6f09b7290fc15b7f895fb41f20558a6f58ecef..be6bc128cd9df2f61211cb7b8f9552b2d745cc0a 100644 (file)
@@ -7,6 +7,7 @@
 #include "strbuf.h"
 #include "string-list.h"
 #include "quote.h"
+#include "config.h"
 
 void child_process_init(struct child_process *child)
 {
@@ -550,8 +551,11 @@ static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
 
        while ((waiting = waitpid(pid, &status, 0)) < 0 && errno == EINTR)
                ;       /* nothing */
-       if (in_signal)
-               return 0;
+       if (in_signal) {
+               if (WIFEXITED(status))
+                       code = WEXITSTATUS(status);
+               return code;
+       }
 
        if (waiting < 0) {
                failed_errno = errno;
@@ -1634,8 +1638,8 @@ static void pp_init(struct parallel_processes *pp,
        pp->nr_processes = 0;
        pp->output_owner = 0;
        pp->shutdown = 0;
-       pp->children = xcalloc(n, sizeof(*pp->children));
-       pp->pfd = xcalloc(n, sizeof(*pp->pfd));
+       CALLOC_ARRAY(pp->children, n);
+       CALLOC_ARRAY(pp->pfd, n);
        strbuf_init(&pp->buffered_output, 0);
 
        for (i = 0; i < n; i++) {
@@ -1875,8 +1879,13 @@ int run_processes_parallel_tr2(int n, get_next_task_fn get_next_task,
 
 int run_auto_maintenance(int quiet)
 {
+       int enabled;
        struct child_process maint = CHILD_PROCESS_INIT;
 
+       if (!git_config_get_bool("maintenance.auto", &enabled) &&
+           !enabled)
+               return 0;
+
        maint.git_cmd = 1;
        strvec_pushl(&maint.args, "maintenance", "run", "--auto", NULL);
        strvec_push(&maint.args, quiet ? "--quiet" : "--no-quiet");