X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=inline;f=builtin-diff.c;h=d5fe775fc135c0905cabec6731104009ca3bfef3;hb=e0e03a731b2d06f42e79a2ff156ef9bd0e5c6c02;hp=7ffea975059f9e13b07ca680e6707ffc14973f90;hpb=65360346309a550185363ef5b846a1202175a4e6;p=git.git diff --git a/builtin-diff.c b/builtin-diff.c index 7ffea9750..d5fe775fc 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -122,6 +122,8 @@ static int builtin_diff_index(struct rev_info *revs, usage(builtin_diff_usage); argv++; argc--; } + if (!cached) + setup_work_tree(); /* * Make sure there is one revision (i.e. pending object), * and there is no revision filtering parameters. @@ -221,10 +223,17 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv argv++; argc--; } - if (revs->max_count == -1 && + /* + * "diff --base" should not combine merges because it was not + * asked to. "diff -c" should not densify (if the user wants + * dense one, --cc can be explicitly asked for, or just rely + * on the default). + */ + if (revs->max_count == -1 && !revs->combine_merges && (revs->diffopt.output_format & DIFF_FORMAT_PATCH)) revs->combine_merges = revs->dense_combined_merges = 1; + setup_work_tree(); if (read_cache() < 0) { perror("read_cache"); return -1;