builtin/diff-tree: cleanup references to sha1
[gitweb.git] / tree-diff.c
index e164e532b2f76617d822c3bef9492b9525b56e83..fc020d76dc651757ea0c6d69d42dedf066370200 100644 (file)
@@ -74,25 +74,25 @@ static int emit_diff_first_parent_only(struct diff_options *opt, struct combine_
 {
        struct combine_diff_parent *p0 = &p->parent[0];
        if (p->mode && p0->mode) {
-               opt->change(opt, p0->mode, p->mode, p0->oid.hash, p->oid.hash,
+               opt->change(opt, p0->mode, p->mode, &p0->oid, &p->oid,
                        1, 1, p->path, 0, 0);
        }
        else {
-               const unsigned char *sha1;
+               const struct object_id *oid;
                unsigned int mode;
                int addremove;
 
                if (p->mode) {
                        addremove = '+';
-                       sha1 = p->oid.hash;
+                       oid = &p->oid;
                        mode = p->mode;
                } else {
                        addremove = '-';
-                       sha1 = p0->oid.hash;
+                       oid = &p0->oid;
                        mode = p0->mode;
                }
 
-               opt->add_remove(opt, addremove, mode, sha1, 1, p->path, 0);
+               opt->add_remove(opt, addremove, mode, oid, 1, p->path, 0);
        }
 
        return 0;       /* we are done with p */
@@ -419,7 +419,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
         * load parents first, as they are probably already cached.
         *
         * ( log_tree_diff() parses commit->parent before calling here via
-        *   diff_tree_sha1(parent, commit) )
+        *   diff_tree_oid(parent, commit) )
         */
        for (i = 0; i < nparent; ++i)
                tptree[i] = fill_tree_descriptor(&tp[i], parents_sha1[i]);
@@ -694,7 +694,9 @@ static int ll_diff_tree_sha1(const unsigned char *old, const unsigned char *new,
        return 0;
 }
 
-int diff_tree_sha1(const unsigned char *old, const unsigned char *new, const char *base_str, struct diff_options *opt)
+int diff_tree_oid(const struct object_id *old_oid,
+                 const struct object_id *new_oid,
+                 const char *base_str, struct diff_options *opt)
 {
        struct strbuf base;
        int retval;
@@ -702,16 +704,16 @@ int diff_tree_sha1(const unsigned char *old, const unsigned char *new, const cha
        strbuf_init(&base, PATH_MAX);
        strbuf_addstr(&base, base_str);
 
-       retval = ll_diff_tree_sha1(old, new, &base, opt);
+       retval = ll_diff_tree_sha1(old_oid->hash, new_oid->hash, &base, opt);
        if (!*base_str && DIFF_OPT_TST(opt, FOLLOW_RENAMES) && diff_might_be_rename())
-               try_to_follow_renames(old, new, &base, opt);
+               try_to_follow_renames(old_oid->hash, new_oid->hash, &base, opt);
 
        strbuf_release(&base);
 
        return retval;
 }
 
-int diff_root_tree_sha1(const unsigned char *new, const char *base, struct diff_options *opt)
+int diff_root_tree_oid(const struct object_id *new_oid, const char *base, struct diff_options *opt)
 {
-       return diff_tree_sha1(NULL, new, base, opt);
+       return diff_tree_oid(NULL, new_oid, base, opt);
 }