summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 49b7120)
raw | patch | inline | side by side (parent: 49b7120)
author | Christian Couder <chriscool@tuxfamily.org> | |
Thu, 22 Jul 2010 13:18:35 +0000 (15:18 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 23 Jul 2010 23:12:48 +0000 (16:12 -0700) |
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c | patch | blob | history |
diff --git a/builtin/blame.c b/builtin/blame.c
index 8506286dd271d4e92369d81ec2cce9240a559d64..8dca385f1fd8f873c0b223b533be1b42dbffb5fd 100644 (file)
--- a/builtin/blame.c
+++ b/builtin/blame.c
int detailed)
{
int len;
- char *tmp, *endp, *reencoded, *message;
+ const char *subject;
+ char *reencoded, *message;
static char author_name[1024];
static char author_mail[1024];
static char committer_name[1024];
&ret->committer_time, &ret->committer_tz);
ret->summary = summary_buf;
- tmp = strstr(message, "\n\n");
- if (!tmp) {
- error_out:
+ len = find_commit_subject(message, &subject);
+ if (len && len < sizeof(summary_buf)) {
+ memcpy(summary_buf, subject, len);
+ summary_buf[len] = 0;
+ } else {
sprintf(summary_buf, "(%s)", sha1_to_hex(commit->object.sha1));
- free(reencoded);
- return;
}
- tmp += 2;
- endp = strchr(tmp, '\n');
- if (!endp)
- endp = tmp + strlen(tmp);
- len = endp - tmp;
- if (len >= sizeof(summary_buf) || len == 0)
- goto error_out;
- memcpy(summary_buf, tmp, len);
- summary_buf[len] = 0;
free(reencoded);
}