aboutsummaryrefslogtreecommitdiff
path: root/builtin-diff-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-diff-index.c')
-rw-r--r--builtin-diff-index.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index 17d851b29..04837494f 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -39,6 +39,8 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
if (rev.pending.nr != 1 ||
rev.max_count != -1 || rev.min_age != -1 || rev.max_age != -1)
usage(diff_cache_usage);
+ if (!cached)
+ setup_work_tree();
if (read_cache() < 0) {
perror("read_cache");
return -1;