X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff.c;h=2fa285a8efc69fac1ba922b0b7ada9230de93c79;hb=c4e05b1a2290c605e68e6dac5e2a580e6d4080b7;hp=5eae0947f35606eab6ff3421fe64fa5cb236f2ad;hpb=d93067d9c7fb210766c7282d662289f54d53f93a;p=git.git diff --git a/diff.c b/diff.c index 5eae0947..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); @@ -267,6 +268,7 @@ static void builtin_diff(const char *name_a, ecbdata.label_path = lbl; xpp.flags = XDF_NEED_MINIMAL; xecfg.ctxlen = 3; + xecfg.flags = XDL_EMIT_FUNCNAMES; if (!diffopts) ; else if (!strncmp(diffopts, "--unified=", 10)) @@ -299,7 +301,7 @@ void fill_filespec(struct diff_filespec *spec, const unsigned char *sha1, unsigned short mode) { if (mode) { - spec->mode = DIFF_FILE_CANON_MODE(mode); + spec->mode = canon_mode(mode); memcpy(spec->sha1, sha1, 20); spec->sha1_valid = !!memcmp(sha1, null_sha1, 20); } @@ -882,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) @@ -1279,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; @@ -1365,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)