diff options
Diffstat (limited to 'builtin/diff.c')
-rw-r--r-- | builtin/diff.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/builtin/diff.c b/builtin/diff.c index da69e4a3c8..ea1dd65a2f 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -298,7 +298,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix) break; } - prefix = setup_git_directory_gently(&nongit); + if (!no_index) + prefix = setup_git_directory_gently(&nongit); + /* * Treat git diff with at least one path outside of the * repo the same as if the command would have been executed @@ -311,7 +313,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix) !path_inside_repo(prefix, argv[i + 1])))) no_index = DIFF_NO_INDEX_IMPLICIT; - gitmodules_config(); + if (!no_index) + gitmodules_config(); git_config(git_diff_ui_config, NULL); init_revisions(&rev, prefix); |