sequencer: get rid of the subcommand field
[gitweb.git] / diff-lib.c
index bc49c708c1854a0f67c25e4fd2b77a9ad50ff511..3007c8524c9b8017cb3dc3f7460e020b0d1aafd7 100644 (file)
@@ -155,7 +155,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                if (2 <= stage) {
                                        int mode = nce->ce_mode;
                                        num_compare_stages++;
-                                       hashcpy(dpath->parent[stage-2].oid.hash, nce->sha1);
+                                       oidcpy(&dpath->parent[stage - 2].oid,
+                                              &nce->oid);
                                        dpath->parent[stage-2].mode = ce_mode_from_stat(nce, mode);
                                        dpath->parent[stage-2].status =
                                                DIFF_STATUS_MODIFIED;
@@ -209,7 +210,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                        continue;
                                }
                                diff_addremove(&revs->diffopt, '-', ce->ce_mode,
-                                              ce->sha1, !is_null_sha1(ce->sha1),
+                                              ce->oid.hash,
+                                              !is_null_oid(&ce->oid),
                                               ce->name, 0);
                                continue;
                        }
@@ -225,8 +227,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
                                continue;
                }
                oldmode = ce->ce_mode;
-               old_sha1 = ce->sha1;
-               new_sha1 = changed ? null_sha1 : ce->sha1;
+               old_sha1 = ce->oid.hash;
+               new_sha1 = changed ? null_sha1 : ce->oid.hash;
                diff_change(&revs->diffopt, oldmode, newmode,
                            old_sha1, new_sha1,
                            !is_null_sha1(old_sha1),
@@ -261,7 +263,7 @@ static int get_stat_data(const struct cache_entry *ce,
                         int cached, int match_missing,
                         unsigned *dirty_submodule, struct diff_options *diffopt)
 {
-       const unsigned char *sha1 = ce->sha1;
+       const unsigned char *sha1 = ce->oid.hash;
        unsigned int mode = ce->ce_mode;
 
        if (!cached && !ce_uptodate(ce)) {
@@ -324,12 +326,13 @@ static int show_modified(struct rev_info *revs,
                          &dirty_submodule, &revs->diffopt) < 0) {
                if (report_missing)
                        diff_index_show_file(revs, "-", old,
-                                            old->sha1, 1, old->ce_mode, 0);
+                                            old->oid.hash, 1, old->ce_mode,
+                                            0);
                return -1;
        }
 
        if (revs->combine_merges && !cached &&
-           (hashcmp(sha1, old->sha1) || hashcmp(old->sha1, new->sha1))) {
+           (hashcmp(sha1, old->oid.hash) || oidcmp(&old->oid, &new->oid))) {
                struct combine_diff_path *p;
                int pathlen = ce_namelen(new);
 
@@ -343,22 +346,22 @@ static int show_modified(struct rev_info *revs,
                memset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));
                p->parent[0].status = DIFF_STATUS_MODIFIED;
                p->parent[0].mode = new->ce_mode;
-               hashcpy(p->parent[0].oid.hash, new->sha1);
+               oidcpy(&p->parent[0].oid, &new->oid);
                p->parent[1].status = DIFF_STATUS_MODIFIED;
                p->parent[1].mode = old->ce_mode;
-               hashcpy(p->parent[1].oid.hash, old->sha1);
+               oidcpy(&p->parent[1].oid, &old->oid);
                show_combined_diff(p, 2, revs->dense_combined_merges, revs);
                free(p);
                return 0;
        }
 
        oldmode = old->ce_mode;
-       if (mode == oldmode && !hashcmp(sha1, old->sha1) && !dirty_submodule &&
+       if (mode == oldmode && !hashcmp(sha1, old->oid.hash) && !dirty_submodule &&
            !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
                return 0;
 
        diff_change(&revs->diffopt, oldmode, mode,
-                   old->sha1, sha1, 1, !is_null_sha1(sha1),
+                   old->oid.hash, sha1, 1, !is_null_sha1(sha1),
                    old->name, 0, dirty_submodule);
        return 0;
 }
@@ -392,7 +395,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
                struct diff_filepair *pair;
                pair = diff_unmerge(&revs->diffopt, idx->name);
                if (tree)
-                       fill_filespec(pair->one, tree->sha1, 1, tree->ce_mode);
+                       fill_filespec(pair->one, tree->oid.hash, 1,
+                                     tree->ce_mode);
                return;
        }
 
@@ -408,7 +412,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
         * Something removed from the tree?
         */
        if (!idx) {
-               diff_index_show_file(revs, "-", tree, tree->sha1, 1, tree->ce_mode, 0);
+               diff_index_show_file(revs, "-", tree, tree->oid.hash, 1,
+                                    tree->ce_mode, 0);
                return;
        }