|
38 | 38 | FUNC(MISSING_TREE, ERROR) \
|
39 | 39 | FUNC(MISSING_TYPE, ERROR) \
|
40 | 40 | FUNC(MISSING_TYPE_ENTRY, ERROR) \
|
| 41 | + FUNC(MULTIPLE_AUTHORS, ERROR) \ |
41 | 42 | FUNC(NUL_IN_HEADER, ERROR) \
|
42 | 43 | FUNC(TAG_OBJECT_NOT_TAG, ERROR) \
|
43 | 44 | FUNC(TREE_NOT_SORTED, ERROR) \
|
@@ -529,7 +530,7 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer,
|
529 | 530 | {
|
530 | 531 | unsigned char tree_sha1[20], sha1[20];
|
531 | 532 | struct commit_graft *graft;
|
532 |
| - unsigned parent_count, parent_line_count = 0; |
| 533 | + unsigned parent_count, parent_line_count = 0, author_count; |
533 | 534 | int err;
|
534 | 535 |
|
535 | 536 | if (require_end_of_header(buffer, size, &commit->object, options))
|
@@ -569,9 +570,17 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer,
|
569 | 570 | return err;
|
570 | 571 | }
|
571 | 572 | }
|
572 |
| - if (!skip_prefix(buffer, "author ", &buffer)) |
573 |
| - return report(options, &commit->object, FSCK_MSG_MISSING_AUTHOR, "invalid format - expected 'author' line"); |
574 |
| - err = fsck_ident(&buffer, &commit->object, options); |
| 573 | + author_count = 0; |
| 574 | + while (skip_prefix(buffer, "author ", &buffer)) { |
| 575 | + author_count++; |
| 576 | + err = fsck_ident(&buffer, &commit->object, options); |
| 577 | + if (err) |
| 578 | + return err; |
| 579 | + } |
| 580 | + if (author_count < 1) |
| 581 | + err = report(options, &commit->object, FSCK_MSG_MISSING_AUTHOR, "invalid format - expected 'author' line"); |
| 582 | + else if (author_count > 1) |
| 583 | + err = report(options, &commit->object, FSCK_MSG_MULTIPLE_AUTHORS, "invalid format - multiple 'author' lines"); |
575 | 584 | if (err)
|
576 | 585 | return err;
|
577 | 586 | if (!skip_prefix(buffer, "committer ", &buffer))
|
|
0 commit comments