Merge branch 'sl/const'
[gitweb.git] / builtin / diff.c
index 361a3c3ed38769f798b83933755fed84724ce43c..9f6109224b7ea75689e9780c5f79343f55e1e3e5 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright (c) 2006 Junio C Hamano
  */
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
 #include "cache.h"
 #include "config.h"
 #include "lockfile.h"
@@ -41,7 +42,7 @@ static void stuff_change(struct diff_options *opt,
        struct diff_filespec *one, *two;
 
        if (!is_null_oid(old_oid) && !is_null_oid(new_oid) &&
-           !oidcmp(old_oid, new_oid) && (old_mode == new_mode))
+           oideq(old_oid, new_oid) && (old_mode == new_mode))
                return;
 
        if (opt->flags.reverse_diff) {
@@ -102,7 +103,7 @@ static int builtin_diff_blobs(struct rev_info *revs,
                              int argc, const char **argv,
                              struct object_array_entry **blob)
 {
-       unsigned mode = canon_mode(S_IFREG | 0644);
+       const unsigned mode = canon_mode(S_IFREG | 0644);
 
        if (argc > 1)
                usage(builtin_diff_usage);
@@ -212,7 +213,7 @@ static void refresh_index_quietly(void)
        discard_cache();
        read_cache();
        refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
-       update_index_if_able(&the_index, &lock_file);
+       repo_update_index_if_able(the_repository, &lock_file);
 }
 
 static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv)
@@ -318,7 +319,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        git_config(git_diff_ui_config, NULL);
        precompose_argv(argc, argv);
 
-       init_revisions(&rev, prefix);
+       repo_init_revisions(the_repository, &rev, prefix);
 
        if (no_index && argc != i + 2) {
                if (no_index == DIFF_NO_INDEX_IMPLICIT) {
@@ -339,7 +340,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
        }
        if (no_index)
                /* If this is a no-index diff, just run it and exit there. */
-               diff_no_index(&rev, argc, argv);
+               diff_no_index(the_repository, &rev, argc, argv);
 
        /* Otherwise, we are doing the usual "git" diff */
        rev.diffopt.skip_stat_unmatch = !!diff_auto_refresh_index;