X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=diff.c;h=ce98a90805f881fa9ef161448af22e859db0d93d;hb=f0853837d6ee69dccfa59222a0e869de94bdddc6;hp=562ca01218c6db870dd0b1b5c0a34ac1cbc1cb2a;hpb=cebff98dbe3fd6177337ae4d440b81ffed797608;p=git.git diff --git a/diff.c b/diff.c index 562ca012..ce98a908 100644 --- a/diff.c +++ b/diff.c @@ -267,6 +267,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 +300,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); } @@ -484,6 +485,8 @@ void diff_free_filespec_data(struct diff_filespec *s) munmap(s->data, s->size); s->should_free = s->should_munmap = 0; s->data = NULL; + free(s->cnt_data); + s->cnt_data = NULL; } static void prep_temp_blob(struct diff_tempfile *temp, @@ -880,6 +883,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) @@ -1277,28 +1282,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;