| 284 | } |
| 285 | |
| 286 | static void process_parent(struct last_modified *lm, |
| 287 | struct prio_queue *queue, |
| 288 | struct commit *c, struct bitmap *active_c, |
| 289 | struct commit *parent, int parent_i) |
| 290 | { |
| 291 | struct bitmap *active_p; |
| 292 | |
| 293 | repo_parse_commit(lm->rev.repo, parent); |
| 294 | active_p = active_paths_for(lm, parent); |
| 295 | |
| 296 | /* |
| 297 | * The first time entering this function for this commit (i.e. first parent) |
| 298 | * see if Bloom filters will tell us it's worth to do the diff. |
| 299 | */ |
| 300 | if (parent_i || maybe_changed_path(lm, c, active_c)) { |
| 301 | diff_tree_oid(&parent->object.oid, |
| 302 | &c->object.oid, "", &lm->rev.diffopt); |
| 303 | diffcore_std(&lm->rev.diffopt); |
| 304 | } |
| 305 | |
| 306 | /* |
| 307 | * Test each path for TREESAME-ness against the parent. If a path is |
| 308 | * TREESAME, pass it on to this parent. |
| 309 | * |
| 310 | * First, collect all paths that are *not* TREESAME in 'scratch'. |
| 311 | * Then, pass paths that *are* TREESAME and active to the parent. |
| 312 | */ |
| 313 | for (int i = 0; i < diff_queued_diff.nr; i++) { |
| 314 | struct diff_filepair *fp = diff_queued_diff.queue[i]; |
| 315 | const char *path = fp->two->path; |
| 316 | struct last_modified_entry *ent = |
| 317 | hashmap_get_entry_from_hash(&lm->paths, strhash(path), path, |
| 318 | struct last_modified_entry, hashent); |
| 319 | if (ent) { |
| 320 | size_t k = ent->diff_idx; |
| 321 | if (bitmap_get(active_c, k)) |
| 322 | bitmap_set(lm->scratch, k); |
| 323 | } |
| 324 | } |
| 325 | for (size_t i = 0; i < lm->all_paths_nr; i++) { |
| 326 | if (bitmap_get(active_c, i) && !bitmap_get(lm->scratch, i)) |
| 327 | pass_to_parent(active_c, active_p, i); |
| 328 | } |
| 329 | |
| 330 | /* |
| 331 | * If parent has any active paths, put it on the queue (if not already). |
| 332 | */ |
| 333 | if (!bitmap_is_empty(active_p) && !(parent->object.flags & PARENT1)) { |
| 334 | parent->object.flags |= PARENT1; |
| 335 | prio_queue_put(queue, parent); |
| 336 | } |
| 337 | if (!(parent->object.flags & PARENT1)) |
| 338 | active_paths_free(lm, parent); |
| 339 | |
| 340 | MEMZERO_ARRAY(lm->scratch->words, lm->scratch->word_alloc); |
| 341 | diff_queue_clear(&diff_queued_diff); |
| 342 | } |
| 343 |
no test coverage detected