This problem has been detected in the wild, and is the primary reason
to introduce an option to demote certain fsck errors to warnings. Let's
offer to ignore this particular problem specifically.

Technically, we could handle such repositories by setting
missing-committer = warn, but that could hide missing tree objects in the
same commit because we cannot continue verifying any commit object after
encountering a missing committer line, while we can continue in the case
of multiple author lines.

Signed-off-by: Johannes Schindelin <johannes.schinde...@gmx.de>
---
 fsck.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fsck.c b/fsck.c
index a63654c..21ff35b 100644
--- a/fsck.c
+++ b/fsck.c
@@ -37,6 +37,7 @@
        FUNC(MISSING_TREE) \
        FUNC(MISSING_TYPE) \
        FUNC(MISSING_TYPE_ENTRY) \
+       FUNC(MULTIPLE_AUTHORS) \
        FUNC(NOT_SORTED) \
        FUNC(NUL_IN_HEADER) \
        FUNC(TAG_OBJECT_NOT_TAG) \
@@ -536,6 +537,13 @@ static int fsck_commit_buffer(struct commit *commit, const 
char *buffer,
        err = fsck_ident(&buffer, &commit->object, options);
        if (err)
                return err;
+       while (skip_prefix(buffer, "author ", &buffer)) {
+               err = report(options, &commit->object, 
FSCK_MSG_MULTIPLE_AUTHORS, "invalid format - multiple 'author' lines");
+               if (err)
+                       return err;
+               /* require_end_of_header() ensured that there is a newline */
+               buffer = strchr(buffer, '\n') + 1;
+       }
        if (!skip_prefix(buffer, "committer ", &buffer))
                return report(options, &commit->object, 
FSCK_MSG_MISSING_COMMITTER, "invalid format - expected 'committer' line");
        err = fsck_ident(&buffer, &commit->object, options);
-- 
2.0.0.rc3.9669.g840d1f9

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to