X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=ll-merge.c;h=2d6b6d6cb1d2bc2d334bf058feb3444e94b5a781;hb=bb96a2c9005f925b4e80ece0a7cd6230f7f4b43d;hp=9723f3a5dc659893080ec1481d595e53f937e252;hpb=66fd74ea5db13e6f095f7c414e9ea4a1aa59cdc7;p=git.git diff --git a/ll-merge.c b/ll-merge.c index 9723f3a5d..2d6b6d6cb 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -55,7 +55,7 @@ static int ll_binary_merge(const struct ll_merge_driver *drv_unused, static int ll_xdl_merge(const struct ll_merge_driver *drv_unused, mmbuffer_t *result, - const char *path_unused, + const char *path, mmfile_t *orig, mmfile_t *src1, const char *name1, mmfile_t *src2, const char *name2, @@ -67,10 +67,10 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused, if (buffer_is_binary(orig->ptr, orig->size) || buffer_is_binary(src1->ptr, src1->size) || buffer_is_binary(src2->ptr, src2->size)) { - warning("Cannot merge binary files: %s vs. %s\n", - name1, name2); + warning("Cannot merge binary files: %s (%s vs. %s)\n", + path, name1, name2); return ll_binary_merge(drv_unused, result, - path_unused, + path, orig, src1, name1, src2, name2, virtual_ancestor); @@ -152,7 +152,7 @@ static void create_temp(mmfile_t *src, char *path) strcpy(path, ".merge_file_XXXXXX"); fd = xmkstemp(path); if (write_in_full(fd, src->ptr, src->size) != src->size) - die("unable to write temp-file"); + die_errno("unable to write temp-file"); close(fd); } @@ -175,8 +175,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn, { "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; @@ -191,18 +190,8 @@ static int ll_ext_merge(const struct ll_merge_driver *fn, 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); - if (status < -ERR_RUN_COMMAND_FORK) - ; /* failure in run-command */ - else - status = -status; + status = run_command_v_opt(args, 0); fd = open(temp[1], O_RDONLY); if (fd < 0) goto bad; @@ -219,7 +208,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn, close(fd); bad: for (i = 0; i < 3; i++) - unlink(temp[i]); + unlink_or_warn(temp[i]); strbuf_release(&cmd); return status; }