Skip to content

Commit 66f414f

Browse files
bmwillgitster
authored andcommitted
diff-tree: convert diff_tree_sha1 to struct object_id
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9e5e0c2 commit 66f414f

File tree

16 files changed

+47
-46
lines changed

16 files changed

+47
-46
lines changed

builtin/blame.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -565,9 +565,9 @@ static struct origin *find_origin(struct scoreboard *sb,
565565
if (is_null_oid(&origin->commit->object.oid))
566566
do_diff_cache(&parent->tree->object.oid, &diff_opts);
567567
else
568-
diff_tree_sha1(parent->tree->object.oid.hash,
569-
origin->commit->tree->object.oid.hash,
570-
"", &diff_opts);
568+
diff_tree_oid(&parent->tree->object.oid,
569+
&origin->commit->tree->object.oid,
570+
"", &diff_opts);
571571
diffcore_std(&diff_opts);
572572

573573
if (!diff_queued_diff.nr) {
@@ -635,9 +635,9 @@ static struct origin *find_rename(struct scoreboard *sb,
635635
if (is_null_oid(&origin->commit->object.oid))
636636
do_diff_cache(&parent->tree->object.oid, &diff_opts);
637637
else
638-
diff_tree_sha1(parent->tree->object.oid.hash,
639-
origin->commit->tree->object.oid.hash,
640-
"", &diff_opts);
638+
diff_tree_oid(&parent->tree->object.oid,
639+
&origin->commit->tree->object.oid,
640+
"", &diff_opts);
641641
diffcore_std(&diff_opts);
642642

643643
for (i = 0; i < diff_queued_diff.nr; i++) {
@@ -1262,7 +1262,7 @@ static void find_copy_in_parent(struct scoreboard *sb,
12621262
/* Try "find copies harder" on new path if requested;
12631263
* we do not want to use diffcore_rename() actually to
12641264
* match things up; find_copies_harder is set only to
1265-
* force diff_tree_sha1() to feed all filepairs to diff_queue,
1265+
* force diff_tree_oid() to feed all filepairs to diff_queue,
12661266
* and this code needs to be after diff_setup_done(), which
12671267
* usually makes find-copies-harder imply copy detection.
12681268
*/
@@ -1274,9 +1274,9 @@ static void find_copy_in_parent(struct scoreboard *sb,
12741274
if (is_null_oid(&target->commit->object.oid))
12751275
do_diff_cache(&parent->tree->object.oid, &diff_opts);
12761276
else
1277-
diff_tree_sha1(parent->tree->object.oid.hash,
1278-
target->commit->tree->object.oid.hash,
1279-
"", &diff_opts);
1277+
diff_tree_oid(&parent->tree->object.oid,
1278+
&target->commit->tree->object.oid,
1279+
"", &diff_opts);
12801280

12811281
if (!DIFF_OPT_TST(&diff_opts, FIND_COPIES_HARDER))
12821282
diffcore_std(&diff_opts);

builtin/diff-tree.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ static int stdin_diff_trees(struct tree *tree1, const char *p)
4949
return -1;
5050
printf("%s %s\n", oid_to_hex(&tree1->object.oid),
5151
oid_to_hex(&tree2->object.oid));
52-
diff_tree_sha1(tree1->object.oid.hash, tree2->object.oid.hash,
53-
"", &log_tree_opt.diffopt);
52+
diff_tree_oid(&tree1->object.oid, &tree2->object.oid,
53+
"", &log_tree_opt.diffopt);
5454
log_tree_diff_flush(&log_tree_opt);
5555
return 0;
5656
}
@@ -148,9 +148,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
148148
if (tree2->flags & UNINTERESTING) {
149149
SWAP(tree2, tree1);
150150
}
151-
diff_tree_sha1(tree1->oid.hash,
152-
tree2->oid.hash,
153-
"", &opt->diffopt);
151+
diff_tree_oid(&tree1->oid, &tree2->oid, "", &opt->diffopt);
154152
log_tree_diff_flush(opt);
155153
break;
156154
}

builtin/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static int builtin_diff_tree(struct rev_info *revs,
174174
swap = 1;
175175
oid[swap] = &ent0->item->oid;
176176
oid[1 - swap] = &ent1->item->oid;
177-
diff_tree_sha1(oid[0]->hash, oid[1]->hash, "", &revs->diffopt);
177+
diff_tree_oid(oid[0], oid[1], "", &revs->diffopt);
178178
log_tree_diff_flush(revs);
179179
return 0;
180180
}

builtin/fast-export.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
562562
get_object_mark(&commit->parents->item->object) != 0 &&
563563
!full_tree) {
564564
parse_commit_or_die(commit->parents->item);
565-
diff_tree_sha1(commit->parents->item->tree->object.oid.hash,
566-
commit->tree->object.oid.hash, "", &rev->diffopt);
565+
diff_tree_oid(&commit->parents->item->tree->object.oid,
566+
&commit->tree->object.oid, "", &rev->diffopt);
567567
}
568568
else
569569
diff_root_tree_oid(&commit->tree->object.oid,

builtin/log.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,9 +1043,9 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
10431043

10441044
diff_setup_done(&opts);
10451045

1046-
diff_tree_sha1(origin->tree->object.oid.hash,
1047-
head->tree->object.oid.hash,
1048-
"", &opts);
1046+
diff_tree_oid(&origin->tree->object.oid,
1047+
&head->tree->object.oid,
1048+
"", &opts);
10491049
diffcore_std(&opts);
10501050
diff_flush(&opts);
10511051

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ static void finish(struct commit *head_commit,
415415
DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
416416
opts.detect_rename = DIFF_DETECT_RENAME;
417417
diff_setup_done(&opts);
418-
diff_tree_sha1(head->hash, new_head->hash, "", &opts);
418+
diff_tree_oid(head, new_head, "", &opts);
419419
diffcore_std(&opts);
420420
diff_flush(&opts);
421421
}

combine-diff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ static struct combine_diff_path *find_paths_generic(const struct object_id *oid,
13361336
opt->output_format = stat_opt;
13371337
else
13381338
opt->output_format = DIFF_FORMAT_NO_OUTPUT;
1339-
diff_tree_sha1(parents->oid[i].hash, oid->hash, "", opt);
1339+
diff_tree_oid(&parents->oid[i], oid, "", opt);
13401340
diffcore_std(opt);
13411341
paths = intersect_paths(paths, i, num_parent);
13421342

@@ -1463,7 +1463,7 @@ void diff_tree_combined(const struct object_id *oid,
14631463
if (stat_opt) {
14641464
diffopts.output_format = stat_opt;
14651465

1466-
diff_tree_sha1(parents->oid[0].hash, oid->hash, "", &diffopts);
1466+
diff_tree_oid(&parents->oid[0], oid, "", &diffopts);
14671467
diffcore_std(&diffopts);
14681468
if (opt->orderfile)
14691469
diffcore_order(opt->orderfile);

diff.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ extern struct combine_diff_path *diff_tree_paths(
213213
struct combine_diff_path *p, const unsigned char *sha1,
214214
const unsigned char **parent_sha1, int nparent,
215215
struct strbuf *base, struct diff_options *opt);
216-
extern int diff_tree_sha1(const unsigned char *old, const unsigned char *new,
217-
const char *base, struct diff_options *opt);
216+
extern int diff_tree_oid(const struct object_id *old_oid,
217+
const struct object_id *new_oid,
218+
const char *base, struct diff_options *opt);
218219
extern int diff_root_tree_oid(const struct object_id *new_oid, const char *base,
219220
struct diff_options *opt);
220221

line-log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,8 @@ static void queue_diffs(struct line_log_data *range,
819819
assert(commit);
820820

821821
DIFF_QUEUE_CLEAR(&diff_queued_diff);
822-
diff_tree_sha1(parent ? parent->tree->object.oid.hash : NULL,
823-
commit->tree->object.oid.hash, "", opt);
822+
diff_tree_oid(parent ? &parent->tree->object.oid : NULL,
823+
&commit->tree->object.oid, "", opt);
824824
if (opt->detect_rename) {
825825
filter_diffs_for_paths(range, 1);
826826
if (diff_might_be_rename())

log-tree.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,8 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
822822
* we merged _in_.
823823
*/
824824
parse_commit_or_die(parents->item);
825-
diff_tree_sha1(parents->item->tree->object.oid.hash,
826-
oid->hash, "", &opt->diffopt);
825+
diff_tree_oid(&parents->item->tree->object.oid,
826+
oid, "", &opt->diffopt);
827827
log_tree_diff_flush(opt);
828828
return !opt->loginfo;
829829
}
@@ -837,8 +837,8 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
837837
struct commit *parent = parents->item;
838838

839839
parse_commit_or_die(parent);
840-
diff_tree_sha1(parent->tree->object.oid.hash,
841-
oid->hash, "", &opt->diffopt);
840+
diff_tree_oid(&parent->tree->object.oid,
841+
oid, "", &opt->diffopt);
842842
log_tree_diff_flush(opt);
843843

844844
showed_log |= !opt->loginfo;

0 commit comments

Comments
 (0)