git commit: Reformat output somewhat
[gitweb.git] / builtin-diff.c
index 7ffea975059f9e13b07ca680e6707ffc14973f90..037c3039a43d198f228fbc64e46d85d4170c1329 100644 (file)
@@ -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.
@@ -225,6 +227,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
            (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;