Merge branch 'jk/split-broken-ident' into maint
The fall-back parsing of commit objects with broken author or committer lines were less robust than ideal in picking up the timestamps. * jk/split-broken-ident: split_ident: parse timestamp from end of line
This commit is contained in:
commit
0ceb7537c1
16
ident.c
16
ident.c
@ -233,7 +233,21 @@ int split_ident_line(struct ident_split *split, const char *line, int len)
|
|||||||
if (!split->mail_end)
|
if (!split->mail_end)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
for (cp = split->mail_end + 1; cp < line + len && isspace(*cp); cp++)
|
/*
|
||||||
|
* Look from the end-of-line to find the trailing ">" of the mail
|
||||||
|
* address, even though we should already know it as split->mail_end.
|
||||||
|
* This can help in cases of broken idents with an extra ">" somewhere
|
||||||
|
* in the email address. Note that we are assuming the timestamp will
|
||||||
|
* never have a ">" in it.
|
||||||
|
*
|
||||||
|
* Note that we will always find some ">" before going off the front of
|
||||||
|
* the string, because will always hit the split->mail_end closing
|
||||||
|
* bracket.
|
||||||
|
*/
|
||||||
|
for (cp = line + len - 1; *cp != '>'; cp--)
|
||||||
|
;
|
||||||
|
|
||||||
|
for (cp = cp + 1; cp < line + len && isspace(*cp); cp++)
|
||||||
;
|
;
|
||||||
if (line + len <= cp)
|
if (line + len <= cp)
|
||||||
goto person_only;
|
goto person_only;
|
||||||
|
@ -13,11 +13,16 @@ test_expect_success 'setup' '
|
|||||||
git update-ref refs/heads/broken_email $(cat broken_email.hash)
|
git update-ref refs/heads/broken_email $(cat broken_email.hash)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'fsck notices broken commit' '
|
||||||
|
git fsck 2>actual &&
|
||||||
|
test_i18ngrep invalid.author actual
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'git log with broken author email' '
|
test_expect_success 'git log with broken author email' '
|
||||||
{
|
{
|
||||||
echo commit $(cat broken_email.hash)
|
echo commit $(cat broken_email.hash)
|
||||||
echo "Author: A U Thor <author@example.com>"
|
echo "Author: A U Thor <author@example.com>"
|
||||||
echo "Date: Thu Jan 1 00:00:00 1970 +0000"
|
echo "Date: Thu Apr 7 15:13:13 2005 -0700"
|
||||||
echo
|
echo
|
||||||
echo " foo"
|
echo " foo"
|
||||||
} >expect.out &&
|
} >expect.out &&
|
||||||
@ -30,7 +35,7 @@ test_expect_success 'git log with broken author email' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'git log --format with broken author email' '
|
test_expect_success 'git log --format with broken author email' '
|
||||||
echo "A U Thor+author@example.com+" >expect.out &&
|
echo "A U Thor+author@example.com+Thu Apr 7 15:13:13 2005 -0700" >expect.out &&
|
||||||
: >expect.err &&
|
: >expect.err &&
|
||||||
|
|
||||||
git log --format="%an+%ae+%ad" broken_email >actual.out 2>actual.err &&
|
git log --format="%an+%ae+%ad" broken_email >actual.out 2>actual.err &&
|
||||||
|
Loading…
Reference in New Issue
Block a user