X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff.c;h=3a2a175c7ec34d5524f8e664c4dd3f05c24f4d4a;hb=e8cc9cd98e2ecd7fd8bb03e725d470405c8e2b94;hp=d3bb10e009f58a36e1f3b09f11253a84ac72c46e;hpb=9e848163eda686093f689c25cfa9937ed2a9fdf8;p=git.git diff --git a/diff.c b/diff.c index d3bb10e0..3a2a175c 100644 --- a/diff.c +++ b/diff.c @@ -237,7 +237,7 @@ static char *pprint_rename(const char *a, const char *b) if (a_midlen < 0) a_midlen = 0; if (b_midlen < 0) b_midlen = 0; - name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7); + name = xmalloc(pfx_length + a_midlen + b_midlen + sfx_length + 7); sprintf(name, "%.*s{%.*s => %.*s}%s", pfx_length, a, a_midlen, a + pfx_length, @@ -1303,6 +1303,14 @@ int diff_setup_done(struct diff_options *options) (options->output_format == DIFF_FORMAT_CHECKDIFF)) options->recursive = 1; + /* + * These combinations do not make sense. + */ + if (options->output_format == DIFF_FORMAT_RAW) + options->with_raw = 0; + if (options->output_format == DIFF_FORMAT_DIFFSTAT) + options->with_stat = 0; + if (options->detect_rename && options->rename_limit < 0) options->rename_limit = diff_rename_limit_default; if (options->setup & DIFF_SETUP_USE_CACHE) {