X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff.c;h=ec51e7dd1832013cda561fa803668b1f2213c96a;hb=2718435b7b746c3c249525b02fbcbad68f5a45f3;hp=17d68fa699f7c88aef8e6c1a0812575bfaec70e1;hpb=92e802c6ccb96d1b5e8561b0a136d43d82253293;p=git.git diff --git a/diff.c b/diff.c index 17d68fa6..ec51e7dd 100644 --- a/diff.c +++ b/diff.c @@ -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: @@ -723,7 +725,7 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o) if (memcmp(one->sha1, two->sha1, 20)) { char one_sha1[41]; - int abbrev = o->full_index ? 40 : DIFF_DEFAULT_INDEX_ABBREV; + int abbrev = o->full_index ? 40 : DEFAULT_ABBREV; memcpy(one_sha1, sha1_to_hex(one->sha1), 41); len += snprintf(msg + len, sizeof(msg) - len, @@ -846,9 +848,14 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac) else if (!strcmp(arg, "--find-copies-harder")) options->find_copies_harder = 1; else if (!strcmp(arg, "--abbrev")) - options->abbrev = DIFF_DEFAULT_ABBREV; - else if (!strncmp(arg, "--abbrev=", 9)) + options->abbrev = DEFAULT_ABBREV; + 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;