X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff.c;h=804c08c2cf64b84dd259d0c9308818c9dfe59d6d;hb=5be4eabf90a4f6d14d3ae16772e6b2e063d71587;hp=8ae6dbc64e3c6c96e37755644d14998dc6e44a5a;hpb=6b1ddbdd6e02719ae2be55dc141a176187e5027e;p=git.git diff --git a/diff.c b/diff.c index 8ae6dbc6..804c08c2 100644 --- 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: @@ -961,7 +963,7 @@ void diff_free_filepair(struct diff_filepair *p) } /* This is different from find_unique_abbrev() in that - * it needs to deal with 0{40} SHA1. + * it stuffs the result with dots for alignment. */ const char *diff_unique_abbrev(const unsigned char *sha1, int len) { @@ -971,16 +973,8 @@ const char *diff_unique_abbrev(const unsigned char *sha1, int len) return sha1_to_hex(sha1); abbrev = find_unique_abbrev(sha1, len); - if (!abbrev) { - if (!memcmp(sha1, null_sha1, 20)) { - char *buf = sha1_to_hex(null_sha1); - if (len < 37) - strcpy(buf + len, "..."); - return buf; - } - else - return sha1_to_hex(sha1); - } + if (!abbrev) + return sha1_to_hex(sha1); abblen = strlen(abbrev); if (abblen < 37) { static char hex[41];