Thread (19 messages) 19 messages, 1 author, 2016-06-15

[PATCH 09/18] fsck: handle multiple authors in commits specially

flat view
DORMANTno replies SUPERSEDED

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:03:14
Subsystem: the rest · Maintainer: Linus Torvalds

Revision v1 of 7 in this series.

Revisions (7)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]
  6. v6 [diff vs current]
  7. v7 [diff vs current]
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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help