| 544 | } |
| 545 | |
| 546 | static int diff_cache(struct rev_info *revs, |
| 547 | const struct object_id *tree_oid, |
| 548 | const char *tree_name, |
| 549 | int cached) |
| 550 | { |
| 551 | struct tree *tree; |
| 552 | struct tree_desc t; |
| 553 | struct unpack_trees_options opts; |
| 554 | |
| 555 | tree = repo_parse_tree_indirect(the_repository, tree_oid); |
| 556 | if (!tree) |
| 557 | return error("bad tree object %s", |
| 558 | tree_name ? tree_name : oid_to_hex(tree_oid)); |
| 559 | memset(&opts, 0, sizeof(opts)); |
| 560 | opts.head_idx = 1; |
| 561 | opts.index_only = cached; |
| 562 | opts.diff_index_cached = (cached && |
| 563 | !revs->diffopt.flags.find_copies_harder); |
| 564 | opts.merge = 1; |
| 565 | opts.fn = oneway_diff; |
| 566 | opts.unpack_data = revs; |
| 567 | opts.src_index = revs->diffopt.repo->index; |
| 568 | opts.dst_index = NULL; |
| 569 | opts.pathspec = &revs->diffopt.pathspec; |
| 570 | opts.pathspec->recursive = 1; |
| 571 | if (revs->diffopt.max_depth_valid) |
| 572 | die(_("max-depth is not supported for index diffs")); |
| 573 | |
| 574 | init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size); |
| 575 | return unpack_trees(1, &t, &opts); |
| 576 | } |
| 577 | |
| 578 | void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb) |
| 579 | { |
no test coverage detected