diff options
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 39b2e165e0..d8820604ca 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -493,8 +493,7 @@ static struct string_list *get_renames(struct merge_options *o, opts.rename_score = o->rename_score; opts.show_rename_progress = o->show_rename_progress; opts.output_format = DIFF_FORMAT_NO_OUTPUT; - if (diff_setup_done(&opts) < 0) - die(_("diff setup failed")); + diff_setup_done(&opts); diff_tree_sha1(o_tree->object.sha1, tree->object.sha1, "", &opts); diffcore_std(&opts); if (opts.needed_rename_limit > o->needed_rename_limit) @@ -614,23 +613,6 @@ static char *unique_path(struct merge_options *o, const char *path, const char * return newpath; } -static void flush_buffer(int fd, const char *buf, unsigned long size) -{ - while (size > 0) { - long ret = write_in_full(fd, buf, size); - if (ret < 0) { - /* Ignore epipe */ - if (errno == EPIPE) - break; - die_errno("merge-recursive"); - } else if (!ret) { - die(_("merge-recursive: disk full?")); - } - size -= ret; - buf += ret; - } -} - static int dir_in_way(const char *path, int check_working_copy) { int pos, pathlen = strlen(path); @@ -789,7 +771,7 @@ static void update_file_flags(struct merge_options *o, fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, mode); if (fd < 0) die_errno(_("failed to open '%s'"), path); - flush_buffer(fd, buf, size); + write_in_full(fd, buf, size); close(fd); } else if (S_ISLNK(mode)) { char *lnk = xmemdupz(buf, size); @@ -862,14 +844,14 @@ static int merge_3way(struct merge_options *o, if (strcmp(a->path, b->path) || (o->ancestor != NULL && strcmp(a->path, one->path) != 0)) { base_name = o->ancestor == NULL ? NULL : - xstrdup(mkpath("%s:%s", o->ancestor, one->path)); - name1 = xstrdup(mkpath("%s:%s", branch1, a->path)); - name2 = xstrdup(mkpath("%s:%s", branch2, b->path)); + mkpathdup("%s:%s", o->ancestor, one->path); + name1 = mkpathdup("%s:%s", branch1, a->path); + name2 = mkpathdup("%s:%s", branch2, b->path); } else { base_name = o->ancestor == NULL ? NULL : - xstrdup(mkpath("%s", o->ancestor)); - name1 = xstrdup(mkpath("%s", branch1)); - name2 = xstrdup(mkpath("%s", branch2)); + mkpathdup("%s", o->ancestor); + name1 = mkpathdup("%s", branch1); + name2 = mkpathdup("%s", branch2); } read_mmblob(&orig, one->sha1); @@ -879,6 +861,7 @@ static int merge_3way(struct merge_options *o, merge_status = ll_merge(result_buf, a->path, &orig, base_name, &src1, name1, &src2, name2, &ll_opts); + free(base_name); free(name1); free(name2); free(orig.ptr); |