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>
brian m. carlson committed
May 6, 2017 at 22:10 UTC
944cffbd18a7dbe0b4c5849da6f093c41b49ea00
5 files changed
+12
-12
builtin/am.c
+1
-1
@@ -1145,7 +1145,7 @@ static int index_has_changes(struct strbuf *sb)
1145
DIFF_OPT_SET(&opt, EXIT_WITH_STATUS);
1146
if (!sb)
1147
DIFF_OPT_SET(&opt, QUICK);
1148
- do_diff_cache(head.hash, &opt);
1148
+ do_diff_cache(&head, &opt);
1149
diffcore_std(&opt);
1150
for (i = 0; sb && i < diff_queued_diff.nr; i++) {
1151
if (i)
builtin/blame.c
+3
-3
@@ -563,7 +563,7 @@ static struct origin *find_origin(struct scoreboard *sb,
563
diff_setup_done(&diff_opts);
564
565
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);
567
else
568
diff_tree_sha1(parent->tree->object.oid.hash,
569
origin->commit->tree->object.oid.hash,
@@ -633,7 +633,7 @@ static struct origin *find_rename(struct scoreboard *sb,
633
diff_setup_done(&diff_opts);
634
635
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);
637
else
638
diff_tree_sha1(parent->tree->object.oid.hash,
639
origin->commit->tree->object.oid.hash,
@@ -1272,7 +1272,7 @@ static void find_copy_in_parent(struct scoreboard *sb,
1272
DIFF_OPT_SET(&diff_opts, FIND_COPIES_HARDER);
1273
1274
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);
1276
else
1277
diff_tree_sha1(parent->tree->object.oid.hash,
1278
target->commit->tree->object.oid.hash,
builtin/reset.c
+1
-1
@@ -154,7 +154,7 @@ static int read_from_tree(const struct pathspec *pathspec,
154
opt.format_callback = update_index_from_diff;
155
opt.format_callback_data = &intent_to_add;
156
157
- if (do_diff_cache(tree_oid->hash, &opt))
157
+ if (do_diff_cache(tree_oid, &opt))
158
return 1;
159
diffcore_std(&opt);
160
diff_flush(&opt);
diff-lib.c
+6
-6
@@ -478,7 +478,7 @@ static int oneway_diff(const struct cache_entry * const *src,
478
}
479
480
static int diff_cache(struct rev_info *revs,
481
- const unsigned char *tree_sha1,
481
+ const struct object_id *tree_oid,
482
const char *tree_name,
483
int cached)
484
{
@@ -486,10 +486,10 @@ static int diff_cache(struct rev_info *revs,
486
struct tree_desc t;
487
struct unpack_trees_options opts;
488
489
- tree = parse_tree_indirect(tree_sha1);
489
+ tree = parse_tree_indirect(tree_oid->hash);
490
if (!tree)
491
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));
493
memset(&opts, 0, sizeof(opts));
494
opts.head_idx = 1;
495
opts.index_only = cached;
@@ -512,7 +512,7 @@ int run_diff_index(struct rev_info *revs, int cached)
512
struct object_array_entry *ent;
513
514
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))
516
exit(128);
517
518
diff_set_mnemonic_prefix(&revs->diffopt, "c/", cached ? "i/" : "w/");
@@ -522,7 +522,7 @@ int run_diff_index(struct rev_info *revs, int cached)
522
return 0;
523
}
524
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)
526
{
527
struct rev_info revs;
528
@@ -530,7 +530,7 @@ int do_diff_cache(const unsigned char *tree_sha1, struct diff_options *opt)
530
copy_pathspec(&revs.prune_data, &opt->pathspec);
531
revs.diffopt = *opt;
532
533
- if (diff_cache(&revs, tree_sha1, NULL, 1))
533
+ if (diff_cache(&revs, tree_oid, NULL, 1))
534
exit(128);
535
return 0;
536
}
diff.h
+1
-1
@@ -354,7 +354,7 @@ extern const char *diff_aligned_abbrev(const struct object_id *sha1, int);
354
extern int run_diff_files(struct rev_info *revs, unsigned int option);
355
extern int run_diff_index(struct rev_info *revs, int cached);
356
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 *);
358
extern int diff_flush_patch_id(struct diff_options *, unsigned char *, int);
359
360
extern int diff_result_code(struct diff_options *, int);