| 664 | } |
| 665 | |
| 666 | static void wt_status_collect_changes_index(struct wt_status *s) |
| 667 | { |
| 668 | struct rev_info rev; |
| 669 | struct setup_revision_opt opt; |
| 670 | |
| 671 | repo_init_revisions(s->repo, &rev, NULL); |
| 672 | memset(&opt, 0, sizeof(opt)); |
| 673 | opt.def = s->is_initial ? empty_tree_oid_hex(s->repo->hash_algo) : s->reference; |
| 674 | setup_revisions(0, NULL, &rev, &opt); |
| 675 | |
| 676 | rev.diffopt.flags.override_submodule_config = 1; |
| 677 | rev.diffopt.ita_invisible_in_index = 1; |
| 678 | if (s->ignore_submodule_arg) { |
| 679 | handle_ignore_submodules_arg(&rev.diffopt, s->ignore_submodule_arg); |
| 680 | } else { |
| 681 | /* |
| 682 | * Unless the user did explicitly request a submodule ignore |
| 683 | * mode by passing a command line option we do not ignore any |
| 684 | * changed submodule SHA-1s when comparing index and HEAD, no |
| 685 | * matter what is configured. Otherwise the user won't be |
| 686 | * shown any submodules manually added (and which are |
| 687 | * staged to be committed), which would be really confusing. |
| 688 | */ |
| 689 | handle_ignore_submodules_arg(&rev.diffopt, "dirty"); |
| 690 | } |
| 691 | |
| 692 | rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK; |
| 693 | rev.diffopt.format_callback = wt_status_collect_updated_cb; |
| 694 | rev.diffopt.format_callback_data = s; |
| 695 | rev.diffopt.detect_rename = s->detect_rename >= 0 ? s->detect_rename : rev.diffopt.detect_rename; |
| 696 | rev.diffopt.rename_limit = s->rename_limit >= 0 ? s->rename_limit : rev.diffopt.rename_limit; |
| 697 | rev.diffopt.rename_score = s->rename_score >= 0 ? s->rename_score : rev.diffopt.rename_score; |
| 698 | |
| 699 | /* |
| 700 | * The `recursive` option must be enabled to allow the diff to recurse |
| 701 | * into subdirectories of sparse directory index entries. If it is not |
| 702 | * enabled, a subdirectory containing file(s) with changes is reported |
| 703 | * as "modified", rather than the modified files themselves. |
| 704 | */ |
| 705 | rev.diffopt.flags.recursive = 1; |
| 706 | |
| 707 | copy_pathspec(&rev.prune_data, &s->pathspec); |
| 708 | run_diff_index(&rev, DIFF_INDEX_CACHED); |
| 709 | release_revisions(&rev); |
| 710 | } |
| 711 | |
| 712 | static int add_file_to_list(const struct object_id *oid, |
| 713 | struct strbuf *base, const char *path, |
no test coverage detected