summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e169b97)
raw | patch | inline | side by side (parent: e169b97)
author | Johannes Sixt <j6t@kdbg.org> | |
Mon, 8 Jun 2009 20:34:29 +0000 (22:34 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 9 Jun 2009 07:15:57 +0000 (00:15 -0700) |
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-receive-pack.c | patch | blob | history | |
ll-merge.c | patch | blob | history | |
merge-index.c | patch | blob | history |
diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c
index 0b08da9b595432efa231eb59d88ecd2b422eb56a..33d345dc3993d01d3cd5ae1cc0aa5ae8eda83edb 100644 (file)
--- a/builtin-receive-pack.c
+++ b/builtin-receive-pack.c
static int run_update_hook(struct command *cmd)
{
static const char update_hook[] = "hooks/update";
- struct child_process proc;
const char *argv[5];
if (access(update_hook, X_OK) < 0)
argv[3] = sha1_to_hex(cmd->new_sha1);
argv[4] = NULL;
- memset(&proc, 0, sizeof(proc));
- proc.argv = argv;
- proc.no_stdin = 1;
- proc.stdout_to_stderr = 1;
-
- return hook_status(run_command(&proc), update_hook);
+ return hook_status(run_command_v_opt(argv, RUN_COMMAND_NO_STDIN |
+ RUN_COMMAND_STDOUT_TO_STDERR),
+ update_hook);
}
static int is_ref_checked_out(const char *ref)
diff --git a/ll-merge.c b/ll-merge.c
index 81c02ad0531e98379d8cd11dc7c2d70214d67fb4..31d6f0a2ee63e8c3cad1053f9281a0ce9917fb32 100644 (file)
--- a/ll-merge.c
+++ b/ll-merge.c
{ "B", temp[2] },
{ NULL }
};
- struct child_process child;
- const char *args[20];
+ const char *args[] = { "sh", "-c", NULL, NULL };
int status, fd, i;
struct stat st;
strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
- memset(&child, 0, sizeof(child));
- child.argv = args;
- args[0] = "sh";
- args[1] = "-c";
args[2] = cmd.buf;
- args[3] = NULL;
-
- status = run_command(&child);
+ status = run_command_v_opt(args, 0);
if (status < -ERR_RUN_COMMAND_FORK)
; /* failure in run-command */
else
diff --git a/merge-index.c b/merge-index.c
index aa9cf23a39ae271a53d1a0c05ac99be0e832b46a..19ddd03e0b2a57d03d85b1e5ca73b0bd4a0d6981 100644 (file)
--- a/merge-index.c
+++ b/merge-index.c
#include "exec_cmd.h"
static const char *pgm;
-static const char *arguments[9];
static int one_shot, quiet;
static int err;
-static void run_program(void)
-{
- struct child_process child;
- memset(&child, 0, sizeof(child));
- child.argv = arguments;
- if (run_command(&child)) {
- if (one_shot) {
- err++;
- } else {
- if (!quiet)
- die("merge program failed");
- exit(1);
- }
- }
-}
-
static int merge_entry(int pos, const char *path)
{
int found;
+ const char *arguments[] = { pgm, "", "", "", path, "", "", "", NULL };
+ char hexbuf[4][60];
+ char ownbuf[4][60];
if (pos >= active_nr)
die("git merge-index: %s not in the cache", path);
- arguments[0] = pgm;
- arguments[1] = "";
- arguments[2] = "";
- arguments[3] = "";
- arguments[4] = path;
- arguments[5] = "";
- arguments[6] = "";
- arguments[7] = "";
- arguments[8] = NULL;
found = 0;
do {
- static char hexbuf[4][60];
- static char ownbuf[4][60];
struct cache_entry *ce = active_cache[pos];
int stage = ce_stage(ce);
} while (++pos < active_nr);
if (!found)
die("git merge-index: %s not in the cache", path);
- run_program();
+
+ if (run_command_v_opt(arguments, 0)) {
+ if (one_shot)
+ err++;
+ else {
+ if (!quiet)
+ die("merge program failed");
+ exit(1);
+ }
+ }
return found;
}