| 7597 | } |
| 7598 | |
| 7599 | struct diff_filepair *diff_queue_addremove(struct diff_queue_struct *queue, |
| 7600 | struct diff_options *options, |
| 7601 | int addremove, unsigned mode, |
| 7602 | const struct object_id *oid, |
| 7603 | int oid_valid, |
| 7604 | const char *concatpath, |
| 7605 | unsigned dirty_submodule) |
| 7606 | { |
| 7607 | struct diff_filespec *one, *two; |
| 7608 | struct diff_filepair *pair; |
| 7609 | |
| 7610 | if (S_ISGITLINK(mode) && is_submodule_ignored(concatpath, options)) |
| 7611 | return NULL; |
| 7612 | |
| 7613 | /* This may look odd, but it is a preparation for |
| 7614 | * feeding "there are unchanged files which should |
| 7615 | * not produce diffs, but when you are doing copy |
| 7616 | * detection you would need them, so here they are" |
| 7617 | * entries to the diff-core. They will be prefixed |
| 7618 | * with something like '=' or '*' (I haven't decided |
| 7619 | * which but should not make any difference). |
| 7620 | * Feeding the same new and old to diff_change() |
| 7621 | * also has the same effect. |
| 7622 | * Before the final output happens, they are pruned after |
| 7623 | * merged into rename/copy pairs as appropriate. |
| 7624 | */ |
| 7625 | if (options->flags.reverse_diff) |
| 7626 | addremove = (addremove == '+' ? '-' : |
| 7627 | addremove == '-' ? '+' : addremove); |
| 7628 | |
| 7629 | if (options->prefix && |
| 7630 | strncmp(concatpath, options->prefix, options->prefix_length)) |
| 7631 | return NULL; |
| 7632 | |
| 7633 | one = alloc_filespec(concatpath); |
| 7634 | two = alloc_filespec(concatpath); |
| 7635 | |
| 7636 | if (addremove != '+') |
| 7637 | fill_filespec(one, oid, oid_valid, mode); |
| 7638 | if (addremove != '-') { |
| 7639 | fill_filespec(two, oid, oid_valid, mode); |
| 7640 | two->dirty_submodule = dirty_submodule; |
| 7641 | } |
| 7642 | |
| 7643 | pair = diff_queue(queue, one, two); |
| 7644 | if (!options->flags.diff_from_contents) |
| 7645 | options->flags.has_changes = 1; |
| 7646 | |
| 7647 | return pair; |
| 7648 | } |
| 7649 | |
| 7650 | struct diff_filepair *diff_queue_change(struct diff_queue_struct *queue, |
| 7651 | struct diff_options *options, |
no test coverage detected