- /* otherwise it is a nonsense; just ignore it */
- }
- else if (!p->two->file_valid) {
- /* deletion */
- dp = diff_queue(&outq, p->one, p->two);
- dp->xfrm_work = 2;
- }
- else {
- /* modification, or stay as is */
- dp = diff_queue(&outq, p->one, p->two);
- dp->xfrm_work = 4;
- }
- free(p);
- }
- debug_queue("done copying original", &outq);
-
- /* Sort outq */
- qsort(outq.queue, outq.nr, sizeof(outq.queue[0]), rank_compare);
-
- debug_queue("done sorting", &outq);
-
- free(q->queue);
- q->nr = q->alloc = 0;
- q->queue = NULL;
-
- /* Copy it out to q, removing duplicates. */
- for (i = 0; i < outq.nr; i++) {
- struct diff_filepair *p = outq.queue[i];
- if (!p->one->file_valid) {
- /* created */
- if (p->two->xfrm_flags & RENAME_DST_MATCHED)
- ; /* rename/copy created it already */
- else
- diff_queue(q, p->one, p->two);
- }
- else if (!p->two->file_valid) {
- /* deleted */
- if (p->one->xfrm_flags & RENAME_SRC_GONE)
- ; /* rename/copy deleted it already */