summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-22 18:11:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-22 18:11:36 (GMT)
commit703319313fc2878c0c28ccc14a488024e8687fc2 (patch)
tree98ead8765fa14f86b491b72896aa3f19871f692f /builtin/blame.c
parent1fc0bfd65ac50c7c2e2a4ae263cf8ee90c106ce6 (diff)
parentde5abe9fe91a496d019d62abefe23df9d72fad30 (diff)
downloadgit-703319313fc2878c0c28ccc14a488024e8687fc2.zip
git-703319313fc2878c0c28ccc14a488024e8687fc2.tar.gz
git-703319313fc2878c0c28ccc14a488024e8687fc2.tar.bz2
Merge branch 'jk/chopped-ident'
A commit object whose author or committer ident are malformed crashed some code that trusted that a name, an email and an timestamp can always be found in it. * jk/chopped-ident: blame: handle broken commit headers gracefully pretty: handle broken commit headers gracefully cat-file: print tags raw for "cat-file -p"
Diffstat (limited to 'builtin/blame.c')
-rw-r--r--builtin/blame.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index 86100e9..7770781 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -1375,10 +1375,15 @@ static void get_ac_line(const char *inbuf, const char *what,
maillen = ident.mail_end - ident.mail_begin;
mailbuf = ident.mail_begin;
- *time = strtoul(ident.date_begin, NULL, 10);
+ if (ident.date_begin && ident.date_end)
+ *time = strtoul(ident.date_begin, NULL, 10);
+ else
+ *time = 0;
- len = ident.tz_end - ident.tz_begin;
- strbuf_add(tz, ident.tz_begin, len);
+ if (ident.tz_begin && ident.tz_end)
+ strbuf_add(tz, ident.tz_begin, ident.tz_end - ident.tz_begin);
+ else
+ strbuf_addstr(tz, "(unknown)");
/*
* Now, convert both name and e-mail using mailmap