Merge branch 'sb/merge-recursive-code-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Fri, 7 Jul 2017 01:14:45 +0000 (18:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Jul 2017 01:14:45 +0000 (18:14 -0700)
Code clean-up.

* sb/merge-recursive-code-cleanup:
merge-recursive: use DIFF_XDL_SET macro

1  2 
merge-recursive.c
diff --combined merge-recursive.c
index 59e5ee41a8cdde0613e5dfa890cb52b21666868f,7a7d55aabeaf46bbd7f77b923e20a66ac4811d5e..1494ffdb828106882053065e3ac8cc383136cf80
@@@ -4,7 -4,6 +4,7 @@@
   * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006
   */
  #include "cache.h"
 +#include "config.h"
  #include "advice.h"
  #include "lockfile.h"
  #include "cache-tree.h"
@@@ -68,7 -67,7 +68,7 @@@ static struct tree *shift_tree_object(s
        }
        if (!oidcmp(&two->object.oid, &shifted))
                return two;
 -      return lookup_tree(shifted.hash);
 +      return lookup_tree(&shifted);
  }
  
  static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
@@@ -305,7 -304,7 +305,7 @@@ struct tree *write_tree_from_memory(str
                return NULL;
        }
  
 -      result = lookup_tree(active_cache_tree->sha1);
 +      result = lookup_tree(&active_cache_tree->oid);
  
        return result;
  }
@@@ -529,7 -528,7 +529,7 @@@ static struct string_list *get_renames(
        opts.show_rename_progress = o->show_rename_progress;
        opts.output_format = DIFF_FORMAT_NO_OUTPUT;
        diff_setup_done(&opts);
 -      diff_tree_sha1(o_tree->object.oid.hash, tree->object.oid.hash, "", &opts);
 +      diff_tree_oid(&o_tree->object.oid, &tree->object.oid, "", &opts);
        diffcore_std(&opts);
        if (opts.needed_rename_limit > o->needed_rename_limit)
                o->needed_rename_limit = opts.needed_rename_limit;
@@@ -995,11 -994,11 +995,11 @@@ static int merge_file_1(struct merge_op
                                return ret;
                        result->clean = (merge_status == 0);
                } else if (S_ISGITLINK(a->mode)) {
 -                      result->clean = merge_submodule(result->oid.hash,
 +                      result->clean = merge_submodule(&result->oid,
                                                       one->path,
 -                                                     one->oid.hash,
 -                                                     a->oid.hash,
 -                                                     b->oid.hash,
 +                                                     &one->oid,
 +                                                     &a->oid,
 +                                                     &b->oid,
                                                       !o->call_depth);
                } else if (S_ISLNK(a->mode)) {
                        oidcpy(&result->oid, &a->oid);
@@@ -1640,8 -1639,8 +1640,8 @@@ static int blob_unchanged(struct merge_
         * performed.  Comparison can be skipped if both files are
         * unchanged since their sha1s have already been compared.
         */
 -      if (renormalize_buffer(path, o.buf, o.len, &o) |
 -          renormalize_buffer(path, a.buf, a.len, &a))
 +      if (renormalize_buffer(&the_index, path, o.buf, o.len, &o) |
 +          renormalize_buffer(&the_index, path, a.buf, a.len, &a))
                ret = (o.len == a.len && !memcmp(o.buf, a.buf, o.len));
  
  error_return:
@@@ -2043,7 -2042,7 +2043,7 @@@ int merge_recursive(struct merge_option
                /* if there is no common ancestor, use an empty tree */
                struct tree *tree;
  
 -              tree = lookup_tree(EMPTY_TREE_SHA1_BIN);
 +              tree = lookup_tree(&empty_tree_oid);
                merged_common_ancestors = make_virtual_commit(tree, "ancestor");
        }
  
@@@ -2104,7 -2103,7 +2104,7 @@@ static struct commit *get_ref(const str
  {
        struct object *object;
  
 -      object = deref_tag(parse_object(oid->hash), name, strlen(name));
 +      object = deref_tag(parse_object(oid), name, strlen(name));
        if (!object)
                return NULL;
        if (object->type == OBJ_TREE)
@@@ -2210,11 -2209,11 +2210,11 @@@ int parse_merge_opt(struct merge_option
                o->xdl_opts |= value;
        }
        else if (!strcmp(s, "ignore-space-change"))
-               o->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
+               DIFF_XDL_SET(o, IGNORE_WHITESPACE_CHANGE);
        else if (!strcmp(s, "ignore-all-space"))
-               o->xdl_opts |= XDF_IGNORE_WHITESPACE;
+               DIFF_XDL_SET(o, IGNORE_WHITESPACE);
        else if (!strcmp(s, "ignore-space-at-eol"))
-               o->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
+               DIFF_XDL_SET(o, IGNORE_WHITESPACE_AT_EOL);
        else if (!strcmp(s, "renormalize"))
                o->renormalize = 1;
        else if (!strcmp(s, "no-renormalize"))