| 107 | } |
| 108 | |
| 109 | void run_diff_files(struct rev_info *revs, unsigned int option) |
| 110 | { |
| 111 | int entries, i; |
| 112 | int diff_unmerged_stage = revs->max_count; |
| 113 | unsigned ce_option = ((option & DIFF_RACY_IS_MODIFIED) |
| 114 | ? CE_MATCH_RACY_IS_DIRTY : 0); |
| 115 | uint64_t start = getnanotime(); |
| 116 | struct index_state *istate = revs->diffopt.repo->index; |
| 117 | |
| 118 | if (revs->diffopt.max_depth_valid) |
| 119 | die(_("max-depth is not supported for worktree diffs")); |
| 120 | |
| 121 | diff_set_mnemonic_prefix(&revs->diffopt, "i/", "w/"); |
| 122 | |
| 123 | refresh_fsmonitor(istate); |
| 124 | |
| 125 | if (diff_unmerged_stage < 0) |
| 126 | diff_unmerged_stage = 2; |
| 127 | entries = istate->cache_nr; |
| 128 | for (i = 0; i < entries; i++) { |
| 129 | unsigned int oldmode, newmode; |
| 130 | struct cache_entry *ce = istate->cache[i]; |
| 131 | int changed; |
| 132 | unsigned dirty_submodule = 0; |
| 133 | const struct object_id *old_oid, *new_oid; |
| 134 | |
| 135 | if (diff_can_quit_early(&revs->diffopt)) |
| 136 | break; |
| 137 | |
| 138 | /* |
| 139 | * NEEDSWORK: |
| 140 | * Here we filter with pathspec but the result is further |
| 141 | * filtered out when --relative is in effect. To end-users, |
| 142 | * a pathspec element that matched only to paths outside the |
| 143 | * current directory is like not matching anything at all; |
| 144 | * the handling of ps_matched[] here may become problematic |
| 145 | * if/when we add the "--error-unmatch" option to "git diff". |
| 146 | */ |
| 147 | if (!ce_path_match(istate, ce, &revs->prune_data, revs->ps_matched)) |
| 148 | continue; |
| 149 | |
| 150 | if (revs->diffopt.prefix && |
| 151 | strncmp(ce->name, revs->diffopt.prefix, revs->diffopt.prefix_length)) |
| 152 | continue; |
| 153 | |
| 154 | if (ce_stage(ce)) { |
| 155 | struct combine_diff_path *dpath; |
| 156 | struct diff_filepair *pair; |
| 157 | unsigned int wt_mode = 0; |
| 158 | int num_compare_stages = 0; |
| 159 | struct stat st; |
| 160 | |
| 161 | changed = check_removed(ce, &st); |
| 162 | if (!changed) |
| 163 | wt_mode = ce_mode_from_stat(ce, st.st_mode); |
| 164 | else { |
| 165 | if (changed < 0) { |
| 166 | perror(ce->name); |
no test coverage detected