X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=diff.c;h=2fa285a8efc69fac1ba922b0b7ada9230de93c79;hb=5910e997754e0a03f25457965bd9faf80f2f9854;hp=2db2cc568dae9e94f56343cb1c900a2da195c9d0;hpb=ca3874a47036cd783ceccc0b6f0e588d84b20223;p=git.git diff --git a/diff.c b/diff.c index 2db2cc56..2fa285a8 100644 --- a/diff.c +++ b/diff.c @@ -142,11 +142,12 @@ static void copy_file(int prefix, const char *data, int size) static void emit_rewrite_diff(const char *name_a, const char *name_b, - struct diff_filespec *one, + struct diff_filespec *one, struct diff_filespec *two) { - /* Use temp[i].name as input, name_a and name_b as labels */ int lc_a, lc_b; + diff_populate_filespec(one, 0); + diff_populate_filespec(two, 0); lc_a = count_lines(one->data, one->size); lc_b = count_lines(two->data, two->size); printf("--- %s\n+++ %s\n@@ -", name_a, name_b); @@ -1282,28 +1283,34 @@ void diff_flush(struct diff_options *options) for (i = 0; i < q->nr; i++) { struct diff_filepair *p = q->queue[i]; - if ((diff_output_format == DIFF_FORMAT_NO_OUTPUT) || - (p->status == DIFF_STATUS_UNKNOWN)) - continue; - if (p->status == 0) - die("internal error in diff-resolve-rename-copy"); - switch (diff_output_format) { - case DIFF_FORMAT_PATCH: - diff_flush_patch(p, options); - break; - case DIFF_FORMAT_RAW: - case DIFF_FORMAT_NAME_STATUS: - diff_flush_raw(p, line_termination, - inter_name_termination, - options); + + switch (p->status) { + case DIFF_STATUS_UNKNOWN: break; - case DIFF_FORMAT_NAME: - diff_flush_name(p, - inter_name_termination, - line_termination); + case 0: + die("internal error in diff-resolve-rename-copy"); break; + default: + switch (diff_output_format) { + case DIFF_FORMAT_PATCH: + diff_flush_patch(p, options); + break; + case DIFF_FORMAT_RAW: + case DIFF_FORMAT_NAME_STATUS: + diff_flush_raw(p, line_termination, + inter_name_termination, + options); + break; + case DIFF_FORMAT_NAME: + diff_flush_name(p, + inter_name_termination, + line_termination); + break; + case DIFF_FORMAT_NO_OUTPUT: + break; + } } - diff_free_filepair(q->queue[i]); + diff_free_filepair(p); } free(q->queue); q->queue = NULL; @@ -1368,8 +1375,6 @@ static void diffcore_apply_filter(const char *filter) void diffcore_std(struct diff_options *options) { - if (options->paths && options->paths[0]) - diffcore_pathspec(options->paths); if (options->break_opt != -1) diffcore_break(options->break_opt); if (options->detect_rename)