Merge branch 'tr/merge-recursive-flush' into maint-1.7.11
authorJunio C Hamano <gitster@pobox.com>
Tue, 11 Sep 2012 17:53:31 +0000 (10:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Sep 2012 17:53:31 +0000 (10:53 -0700)
* tr/merge-recursive-flush:
merge-recursive: eliminate flush_buffer() in favor of write_in_full()

1  2 
merge-recursive.c
diff --combined merge-recursive.c
index 680937c39e2dacb7aaa008ee77b34eb9f7c208cb,eed936ebec2a83fa87d67e9c25093546fe77bb57..8801b9d2f1eeb0710ac40df0058bd36ab123f104
@@@ -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"))