| 407 | }; |
| 408 | |
| 409 | static void collect_changes_cb(struct diff_queue_struct *q, |
| 410 | struct diff_options *options, |
| 411 | void *data) |
| 412 | { |
| 413 | struct collection_status *s = data; |
| 414 | struct diffstat_t stat = { 0 }; |
| 415 | int i; |
| 416 | |
| 417 | if (!q->nr) |
| 418 | return; |
| 419 | |
| 420 | compute_diffstat(options, &stat, q); |
| 421 | |
| 422 | for (i = 0; i < stat.nr; i++) { |
| 423 | const char *name = stat.files[i]->name; |
| 424 | int hash = strhash(name); |
| 425 | struct pathname_entry *entry; |
| 426 | struct file_item *file_item; |
| 427 | struct adddel *adddel, *other_adddel; |
| 428 | |
| 429 | entry = hashmap_get_entry_from_hash(&s->file_map, hash, name, |
| 430 | struct pathname_entry, ent); |
| 431 | if (!entry) { |
| 432 | if (s->skip_unseen) |
| 433 | continue; |
| 434 | |
| 435 | add_file_item(s->files, name); |
| 436 | |
| 437 | CALLOC_ARRAY(entry, 1); |
| 438 | hashmap_entry_init(&entry->ent, hash); |
| 439 | entry->name = s->files->items[s->files->nr - 1].string; |
| 440 | entry->item = s->files->items[s->files->nr - 1].util; |
| 441 | hashmap_add(&s->file_map, &entry->ent); |
| 442 | } |
| 443 | |
| 444 | file_item = entry->item; |
| 445 | adddel = s->mode == FROM_INDEX ? |
| 446 | &file_item->index : &file_item->worktree; |
| 447 | other_adddel = s->mode == FROM_INDEX ? |
| 448 | &file_item->worktree : &file_item->index; |
| 449 | adddel->seen = 1; |
| 450 | adddel->add = stat.files[i]->added; |
| 451 | adddel->del = stat.files[i]->deleted; |
| 452 | if (stat.files[i]->is_binary) { |
| 453 | if (!other_adddel->binary) |
| 454 | s->binary_count++; |
| 455 | adddel->binary = 1; |
| 456 | } |
| 457 | if (stat.files[i]->is_unmerged) { |
| 458 | if (!other_adddel->unmerged) |
| 459 | s->unmerged_count++; |
| 460 | adddel->unmerged = 1; |
| 461 | } |
| 462 | } |
| 463 | free_diffstat_info(&stat); |
| 464 | } |
| 465 | |
| 466 | enum modified_files_filter { |
nothing calls this directly
no test coverage detected