git-p4: place temporary refs used for branch import under refs/git-p4-tmp
[gitweb.git] / tree-diff.c
index 286cab8177b421b971f9b864ce7dffd583af541e..e164e532b2f76617d822c3bef9492b9525b56e83 100644 (file)
@@ -74,7 +74,7 @@ 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->sha1, p->sha1,
+               opt->change(opt, p0->mode, p->mode, p0->oid.hash, p->oid.hash,
                        1, 1, p->path, 0, 0);
        }
        else {
@@ -84,11 +84,11 @@ static int emit_diff_first_parent_only(struct diff_options *opt, struct combine_
 
                if (p->mode) {
                        addremove = '+';
-                       sha1 = p->sha1;
+                       sha1 = p->oid.hash;
                        mode = p->mode;
                } else {
                        addremove = '-';
-                       sha1 = p0->sha1;
+                       sha1 = p0->oid.hash;
                        mode = p0->mode;
                }
 
@@ -161,7 +161,7 @@ static struct combine_diff_path *path_appendnew(struct combine_diff_path *last,
        memcpy(p->path + base->len, path, pathlen);
        p->path[len] = 0;
        p->mode = mode;
-       hashcpy(p->sha1, sha1 ? sha1 : null_sha1);
+       hashcpy(p->oid.hash, sha1 ? sha1 : null_sha1);
 
        return p;
 }
@@ -193,7 +193,7 @@ static struct combine_diff_path *emit_path(struct combine_diff_path *p,
 
        if (t) {
                /* path present in resulting tree */
-               sha1 = tree_entry_extract(t, &path, &mode);
+               sha1 = tree_entry_extract(t, &path, &mode)->hash;
                pathlen = tree_entry_len(&t->entry);
                isdir = S_ISDIR(mode);
        } else {
@@ -239,7 +239,7 @@ static struct combine_diff_path *emit_path(struct combine_diff_path *p,
                                                DIFF_STATUS_ADDED;
 
                        if (tpi_valid) {
-                               sha1_i = tp[i].entry.sha1;
+                               sha1_i = tp[i].entry.oid->hash;
                                mode_i = tp[i].entry.mode;
                        }
                        else {
@@ -248,7 +248,7 @@ static struct combine_diff_path *emit_path(struct combine_diff_path *p,
                        }
 
                        p->parent[i].mode = mode_i;
-                       hashcpy(p->parent[i].sha1, sha1_i ? sha1_i : null_sha1);
+                       hashcpy(p->parent[i].oid.hash, sha1_i ? sha1_i : null_sha1);
                }
 
                keep = 1;
@@ -280,7 +280,7 @@ static struct combine_diff_path *emit_path(struct combine_diff_path *p,
                        /* same rule as in emitthis */
                        int tpi_valid = tp && !(tp[i].entry.mode & S_IFXMIN_NEQ);
 
-                       parents_sha1[i] = tpi_valid ? tp[i].entry.sha1
+                       parents_sha1[i] = tpi_valid ? tp[i].entry.oid->hash
                                                    : NULL;
                }
 
@@ -492,7 +492,7 @@ static struct combine_diff_path *ll_diff_tree_paths(
                                                continue;
 
                                        /* diff(t,pi) != ΓΈ */
-                                       if (hashcmp(t.entry.sha1, tp[i].entry.sha1) ||
+                                       if (oidcmp(t.entry.oid, tp[i].entry.oid) ||
                                            (t.entry.mode != tp[i].entry.mode))
                                                continue;
 
@@ -617,7 +617,7 @@ static void try_to_follow_renames(const unsigned char *old, const unsigned char
        diff_setup_done(&diff_opts);
        ll_diff_tree_sha1(old, new, base, &diff_opts);
        diffcore_std(&diff_opts);
-       free_pathspec(&diff_opts.pathspec);
+       clear_pathspec(&diff_opts.pathspec);
 
        /* Go through the new set of filepairing, and see if we find a more interesting one */
        opt->found_follow = 0;
@@ -640,7 +640,7 @@ static void try_to_follow_renames(const unsigned char *old, const unsigned char
                        /* Update the path we use from now on.. */
                        path[0] = p->one->path;
                        path[1] = NULL;
-                       free_pathspec(&opt->pathspec);
+                       clear_pathspec(&opt->pathspec);
                        parse_pathspec(&opt->pathspec,
                                       PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
                                       PATHSPEC_LITERAL_PATH, "", path);