From: Junio C Hamano Date: Tue, 11 Sep 2012 17:53:31 +0000 (-0700) Subject: Merge branch 'tr/merge-recursive-flush' into maint-1.7.11 X-Git-Tag: v1.7.11.6~13 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3f835949e9b800619136f2511e84000c95916d6e?hp=-c Merge branch 'tr/merge-recursive-flush' into maint-1.7.11 * tr/merge-recursive-flush: merge-recursive: eliminate flush_buffer() in favor of write_in_full() --- 3f835949e9b800619136f2511e84000c95916d6e diff --combined merge-recursive.c index 680937c39e,eed936ebec..8801b9d2f1 --- a/merge-recursive.c +++ b/merge-recursive.c @@@ -264,7 -264,7 +264,7 @@@ struct tree *write_tree_from_memory(str if (!cache_tree_fully_valid(active_cache_tree) && cache_tree_update(active_cache_tree, - active_cache, active_nr, 0, 0, 0) < 0) + active_cache, active_nr, 0) < 0) die("error building trees"); result = lookup_tree(active_cache_tree->sha1); @@@ -485,7 -485,6 +485,7 @@@ static struct string_list *get_renames( renames = xcalloc(1, sizeof(struct string_list)); diff_setup(&opts); DIFF_OPT_SET(&opts, RECURSIVE); + DIFF_OPT_CLR(&opts, RENAME_EMPTY); opts.detect_rename = DIFF_DETECT_RENAME; opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit : o->diff_rename_limit >= 0 ? o->diff_rename_limit : @@@ -614,23 -613,6 +614,6 @@@ static char *unique_path(struct merge_o 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 +772,7 @@@ static void update_file_flags(struct me 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); @@@ -1915,7 -1897,7 +1898,7 @@@ int merge_recursive(struct merge_option /* if there is no common ancestor, use an empty tree */ struct tree *tree; - tree = lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN); + tree = lookup_tree(EMPTY_TREE_SHA1_BIN); merged_common_ancestors = make_virtual_commit(tree, "ancestor"); } @@@ -2069,9 -2051,9 +2052,9 @@@ int parse_merge_opt(struct merge_option else if (!prefixcmp(s, "subtree=")) o->subtree_shift = s + strlen("subtree="); else if (!strcmp(s, "patience")) - o->xdl_opts |= XDF_PATIENCE_DIFF; + o->xdl_opts = DIFF_WITH_ALG(o, PATIENCE_DIFF); else if (!strcmp(s, "histogram")) - o->xdl_opts |= XDF_HISTOGRAM_DIFF; + o->xdl_opts = DIFF_WITH_ALG(o, HISTOGRAM_DIFF); else if (!strcmp(s, "ignore-space-change")) o->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE; else if (!strcmp(s, "ignore-all-space"))