pack-objects: fix thinko in revalidate code
[gitweb.git] / builtin-diff-stages.c
index 7c157ca889eaf85b38be2764fca83814bb83a3f4..70bb89808d2296246edbafb8378aa651c3382261 100644 (file)
@@ -46,7 +46,7 @@ static void diff_stages(int stage1, int stage2, const char **pathspec)
                else if (!two)
                        diff_addremove(&diff_options, '-', ntohl(one->ce_mode),
                                       one->sha1, name, NULL);
-               else if (memcmp(one->sha1, two->sha1, 20) ||
+               else if (hashcmp(one->sha1, two->sha1) ||
                         (one->ce_mode != two->ce_mode) ||
                         diff_options.find_copies_harder)
                        diff_change(&diff_options,
@@ -55,13 +55,12 @@ static void diff_stages(int stage1, int stage2, const char **pathspec)
        }
 }
 
-int cmd_diff_stages(int ac, const char **av, char **envp)
+int cmd_diff_stages(int ac, const char **av, const char *prefix)
 {
        int stage1, stage2;
-       const char *prefix = setup_git_directory();
        const char **pathspec = NULL;
 
-       git_config(git_diff_config);
+       git_config(git_default_config); /* no "diff" UI options */
        read_cache();
        diff_setup(&diff_options);
        while (1 < ac && av[1][0] == '-') {
@@ -85,6 +84,9 @@ int cmd_diff_stages(int ac, const char **av, char **envp)
                ac--; av++;
        }
 
+       if (!diff_options.output_format)
+               diff_options.output_format = DIFF_FORMAT_RAW;
+
        if (ac < 3 ||
            sscanf(av[1], "%d", &stage1) != 1 ||
            ! (0 <= stage1 && stage1 <= 3) ||