Code

Merge branches 'jc/nostat' and 'jc/empty-commit'
[git.git] / diff.c
diff --git a/diff.c b/diff.c
index 69767b9de97f27306032d7af1aa05d0bdbf5315f..c72064eeb2d8ca979a0aa68c2264bb2c49eb608a 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -311,7 +311,7 @@ static int work_tree_matches(const char *name, const unsigned char *sha1)
        ce = active_cache[pos];
        if ((lstat(name, &st) < 0) ||
            !S_ISREG(st.st_mode) || /* careful! */
-           ce_match_stat(ce, &st) ||
+           ce_match_stat(ce, &st, 0) ||
            memcmp(sha1, ce->sha1, 20))
                return 0;
        /* we return 1 only when we can stat, it is a regular file,
@@ -555,6 +555,8 @@ static void remove_tempfile(void)
 static void remove_tempfile_on_signal(int signo)
 {
        remove_tempfile();
+       signal(SIGINT, SIG_DFL);
+       raise(signo);
 }
 
 /* An external diff command takes:
@@ -847,8 +849,13 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
                options->find_copies_harder = 1;
        else if (!strcmp(arg, "--abbrev"))
                options->abbrev = DEFAULT_ABBREV;
-       else if (!strncmp(arg, "--abbrev=", 9))
+       else if (!strncmp(arg, "--abbrev=", 9)) {
                options->abbrev = strtoul(arg + 9, NULL, 10);
+               if (options->abbrev < MINIMUM_ABBREV)
+                       options->abbrev = MINIMUM_ABBREV;
+               else if (40 < options->abbrev)
+                       options->abbrev = 40;
+       }
        else
                return 0;
        return 1;