Limit the size of the new delta_base_cache
[gitweb.git] / merge-index.c
index 646d090c58e774bdf0f412da39f4b67fd7a696c6..6df43944b08fc7789eec2314353bd1f892afbf0b 100644 (file)
@@ -1,8 +1,5 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <signal.h>
-
 #include "cache.h"
+#include "run-command.h"
 
 static const char *pgm;
 static const char *arguments[8];
@@ -11,24 +8,10 @@ static int err;
 
 static void run_program(void)
 {
-       pid_t pid = fork();
-       int status;
-
-       if (pid < 0)
-               die("unable to fork");
-       if (!pid) {
-               execlp(pgm, arguments[0],
-                           arguments[1],
-                           arguments[2],
-                           arguments[3],
-                           arguments[4],
-                           arguments[5],
-                           arguments[6],
-                           arguments[7],
-                           NULL);
-               die("unable to execute '%s'", pgm);
-       }
-       if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) {
+       struct child_process child;
+       memset(&child, 0, sizeof(child));
+       child.argv = arguments;
+       if (run_command(&child)) {
                if (one_shot) {
                        err++;
                } else {
@@ -64,7 +47,7 @@ static int merge_entry(int pos, const char *path)
                        break;
                found++;
                strcpy(hexbuf[stage], sha1_to_hex(ce->sha1));
-               sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode) & (~S_IFMT));
+               sprintf(ownbuf[stage], "%o", ntohl(ce->ce_mode));
                arguments[stage] = hexbuf[stage];
                arguments[stage + 4] = ownbuf[stage];
        } while (++pos < active_nr);