Skip to content

Commit 944cffb

Browse files
bk2204gitster
authored andcommitted
diff-lib: convert do_diff_cache to struct object_id
This is needed to convert parse_tree_indirect. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a9b5f5b commit 944cffb

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ static int index_has_changes(struct strbuf *sb)
11451145
DIFF_OPT_SET(&opt, EXIT_WITH_STATUS);
11461146
if (!sb)
11471147
DIFF_OPT_SET(&opt, QUICK);
1148-
do_diff_cache(head.hash, &opt);
1148+
do_diff_cache(&head, &opt);
11491149
diffcore_std(&opt);
11501150
for (i = 0; sb && i < diff_queued_diff.nr; i++) {
11511151
if (i)

builtin/blame.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static struct origin *find_origin(struct scoreboard *sb,
563563
diff_setup_done(&diff_opts);
564564

565565
if (is_null_oid(&origin->commit->object.oid))
566-
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
566+
do_diff_cache(&parent->tree->object.oid, &diff_opts);
567567
else
568568
diff_tree_sha1(parent->tree->object.oid.hash,
569569
origin->commit->tree->object.oid.hash,
@@ -633,7 +633,7 @@ static struct origin *find_rename(struct scoreboard *sb,
633633
diff_setup_done(&diff_opts);
634634

635635
if (is_null_oid(&origin->commit->object.oid))
636-
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
636+
do_diff_cache(&parent->tree->object.oid, &diff_opts);
637637
else
638638
diff_tree_sha1(parent->tree->object.oid.hash,
639639
origin->commit->tree->object.oid.hash,
@@ -1272,7 +1272,7 @@ static void find_copy_in_parent(struct scoreboard *sb,
12721272
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
12731273

12741274
if (is_null_oid(&target->commit->object.oid))
1275-
do_diff_cache(parent->tree->object.oid.hash, &diff_opts);
1275+
do_diff_cache(&parent->tree->object.oid, &diff_opts);
12761276
else
12771277
diff_tree_sha1(parent->tree->object.oid.hash,
12781278
target->commit->tree->object.oid.hash,

builtin/reset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int read_from_tree(const struct pathspec *pathspec,
154154
opt.format_callback = update_index_from_diff;
155155
opt.format_callback_data = &intent_to_add;
156156

157-
if (do_diff_cache(tree_oid->hash, &opt))
157+
if (do_diff_cache(tree_oid, &opt))
158158
return 1;
159159
diffcore_std(&opt);
160160
diff_flush(&opt);

diff-lib.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,18 +478,18 @@ static int oneway_diff(const struct cache_entry * const *src,
478478
}
479479

480480
static int diff_cache(struct rev_info *revs,
481-
const unsigned char *tree_sha1,
481+
const struct object_id *tree_oid,
482482
const char *tree_name,
483483
int cached)
484484
{
485485
struct tree *tree;
486486
struct tree_desc t;
487487
struct unpack_trees_options opts;
488488

489-
tree = parse_tree_indirect(tree_sha1);
489+
tree = parse_tree_indirect(tree_oid->hash);
490490
if (!tree)
491491
return error("bad tree object %s",
492-
tree_name ? tree_name : sha1_to_hex(tree_sha1));
492+
tree_name ? tree_name : oid_to_hex(tree_oid));
493493
memset(&opts, 0, sizeof(opts));
494494
opts.head_idx = 1;
495495
opts.index_only = cached;
@@ -512,7 +512,7 @@ int run_diff_index(struct rev_info *revs, int cached)
512512
struct object_array_entry *ent;
513513

514514
ent = revs->pending.objects;
515-
if (diff_cache(revs, ent->item->oid.hash, ent->name, cached))
515+
if (diff_cache(revs, &ent->item->oid, ent->name, cached))
516516
exit(128);
517517

518518
diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
@@ -522,15 +522,15 @@ int run_diff_index(struct rev_info *revs, int cached)
522522
return 0;
523523
}
524524

525-
int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
525+
int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
526526
{
527527
struct rev_info revs;
528528

529529
init_revisions(&revs, NULL);
530530
copy_pathspec(&revs.prune_data, &opt->pathspec);
531531
revs.diffopt = *opt;
532532

533-
if (diff_cache(&revs, tree_sha1, NULL, 1))
533+
if (diff_cache(&revs, tree_oid, NULL, 1))
534534
exit(128);
535535
return 0;
536536
}

diff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ extern const char *diff_aligned_abbrev(const struct object_id *sha1, int);
354354
extern int run_diff_files(struct rev_info *revs, unsigned int option);
355355
extern int run_diff_index(struct rev_info *revs, int cached);
356356

357-
extern int do_diff_cache(const unsigned char *, struct diff_options *);
357+
extern int do_diff_cache(const struct object_id *, struct diff_options *);
358358
extern int diff_flush_patch_id(struct diff_options *, unsigned char *, int);
359359

360360
extern int diff_result_code(struct diff_options *, int);

0 commit comments

Comments
 (0)