{"thread":{"id":"30587","subject":"[PATCH] fix off-by-one error in split_ident_line","startedAt":"2012-05-22T06:12:20Z","lastAt":"2012-05-22T06:12:20Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"191881","messageId":"20120522061220.GA17886@sigill.intra.peff.net","threadId":"30587","inReplyTo":null,"subject":"[PATCH] fix off-by-one error in split_ident_line","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-22T06:12:20Z","receivedAt":"2012-05-22T06:12:20Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Commit 4b340cf split the logic to parse an ident line out of\npretty.c's format_person_part. But in doing so, it\naccidentally introduced an off-by-one error that caused it\nto think that single-character names were invalid.\n\nThis manifested itself as the \"%an\" format failing to show\nanything at all for a single-character name.\n\nReported-by: Brian Turner <bturner@atlassian.com>\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ident.c                    | 2 +-\n t/t6006-rev-list-format.sh | 7 +++++++\n 2 files changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/ident.c b/ident.c\nindex 87c697c..5df094d 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -244,7 +244,7 @@ int split_ident_line(struct ident_split *split, const char *line, int len)\n \tif (!split->mail_begin)\n \t\treturn status;\n \n-\tfor (cp = split->mail_begin - 2; line < cp; cp--)\n+\tfor (cp = split->mail_begin - 2; line <= cp; cp--)\n \t\tif (!isspace(*cp)) {\n \t\t\tsplit->name_end = cp + 1;\n \t\t\tbreak;\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex a01d244..f94f0c4 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -283,4 +283,11 @@ test_expect_success 'oneline with empty message' '\n \ttest_line_count = 5 testg.txt\n '\n \n+test_expect_success 'single-character name is parsed correctly' '\n+\tgit commit --author=\"a <a@example.com>\" --allow-empty -m foo &&\n+\techo \"a <a@example.com>\" >expect &&\n+\tgit log -1 --format=\"%an <%ae>\" >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \n1.7.9.7.33.gc430a50\n"}]}