summaryrefslogtreecommitdiff
path: root/builtin/diff-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/diff-index.c')
-rw-r--r--builtin/diff-index.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 7d158af..3e05260 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -1,16 +1,17 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
-#include "cache.h"
+#include "builtin.h"
#include "config.h"
#include "diff.h"
#include "diff-merges.h"
#include "commit.h"
+#include "preload-index.h"
+#include "repository.h"
#include "revision.h"
-#include "builtin.h"
-#include "submodule.h"
+#include "setup.h"
static const char diff_cache_usage[] =
-"git diff-index [-m] [--cached] "
+"git diff-index [-m] [--cached] [--merge-base] "
"[<common-diff-options>] <tree-ish> [<path>...]"
+"\n"
COMMON_DIFF_OPTIONS_HELP;
int cmd_diff_index(int argc, const char **argv, const char *prefix)
@@ -61,16 +62,16 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
usage(diff_cache_usage);
if (!(option & DIFF_INDEX_CACHED)) {
setup_work_tree();
- if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
- perror("read_cache_preload");
+ if (repo_read_index_preload(the_repository, &rev.diffopt.pathspec, 0) < 0) {
+ perror("repo_read_index_preload");
return -1;
}
- } else if (read_cache() < 0) {
- perror("read_cache");
+ } else if (repo_read_index(the_repository) < 0) {
+ perror("repo_read_index");
return -1;
}
- result = run_diff_index(&rev, option);
- result = diff_result_code(&rev.diffopt, result);
+ run_diff_index(&rev, option);
+ result = diff_result_code(&rev.diffopt);
release_revisions(&rev);
return result;
}