X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff.c;h=30e4d50b951257829d2727c6076f7baa6488a473;hb=a13ba129cdc66b60eef177696084ff80034069b7;hp=e496905bad9853f912e1bbcc081c544524f8cb77;hpb=4c61b7d15a6215fa4dffa33c37c3ef9df80d3f67;p=git.git diff --git a/diff.c b/diff.c index e496905b..30e4d50b 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); @@ -883,6 +884,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) options->filter = arg + 14; else if (!strcmp(arg, "--pickaxe-all")) options->pickaxe_opts = DIFF_PICKAXE_ALL; + else if (!strcmp(arg, "--pickaxe-regex")) + options->pickaxe_opts = DIFF_PICKAXE_REGEX; else if (!strncmp(arg, "-B", 2)) { if ((options->break_opt = diff_scoreopt_parse(arg)) == -1) @@ -1280,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;