| 127 | } |
| 128 | |
| 129 | static int pickaxe_match(struct diff_filepair *p, struct diff_options *o, |
| 130 | regex_t *regexp, kwset_t kws, pickaxe_fn fn) |
| 131 | { |
| 132 | struct userdiff_driver *textconv_one = NULL; |
| 133 | struct userdiff_driver *textconv_two = NULL; |
| 134 | mmfile_t mf1, mf2; |
| 135 | int ret; |
| 136 | |
| 137 | /* ignore unmerged */ |
| 138 | if (!DIFF_FILE_VALID(p->one) && !DIFF_FILE_VALID(p->two)) |
| 139 | return 0; |
| 140 | |
| 141 | if (o->objfind) { |
| 142 | return (DIFF_FILE_VALID(p->one) && |
| 143 | oidset_contains(o->objfind, &p->one->oid)) || |
| 144 | (DIFF_FILE_VALID(p->two) && |
| 145 | oidset_contains(o->objfind, &p->two->oid)); |
| 146 | } |
| 147 | |
| 148 | if (o->flags.allow_textconv) { |
| 149 | textconv_one = get_textconv(o->repo, p->one); |
| 150 | textconv_two = get_textconv(o->repo, p->two); |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | * If we have an unmodified pair, we know that the count will be the |
| 155 | * same and don't even have to load the blobs. Unless textconv is in |
| 156 | * play, _and_ we are using two different textconv filters (e.g., |
| 157 | * because a pair is an exact rename with different textconv attributes |
| 158 | * for each side, which might generate different content). |
| 159 | */ |
| 160 | if (textconv_one == textconv_two && diff_unmodified_pair(p)) |
| 161 | return 0; |
| 162 | |
| 163 | if ((o->pickaxe_opts & DIFF_PICKAXE_KIND_G) && |
| 164 | !o->flags.text && |
| 165 | ((!textconv_one && diff_filespec_is_binary(o->repo, p->one)) || |
| 166 | (!textconv_two && diff_filespec_is_binary(o->repo, p->two)))) |
| 167 | return 0; |
| 168 | |
| 169 | mf1.size = fill_textconv(o->repo, textconv_one, p->one, &mf1.ptr); |
| 170 | mf2.size = fill_textconv(o->repo, textconv_two, p->two, &mf2.ptr); |
| 171 | |
| 172 | ret = fn(&mf1, &mf2, o, regexp, kws); |
| 173 | |
| 174 | if (textconv_one) |
| 175 | free(mf1.ptr); |
| 176 | if (textconv_two) |
| 177 | free(mf2.ptr); |
| 178 | diff_free_filespec_data(p->one); |
| 179 | diff_free_filespec_data(p->two); |
| 180 | |
| 181 | return ret; |
| 182 | } |
| 183 | |
| 184 | static void pickaxe(struct diff_queue_struct *q, struct diff_options *o, |
| 185 | regex_t *regexp, kwset_t kws, pickaxe_fn fn) |
no test coverage detected