{"thread":{"id":"23918","subject":"[PATCH] fsck: fix bogus commit header check","startedAt":"2010-05-26T21:50:34Z","lastAt":"2010-05-29T01:10:34Z","messageCount":2,"participants":["Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"142396","messageId":"20100526215034.GA6872@progeny.tock","threadId":"23918","inReplyTo":null,"subject":"[PATCH] fsck: fix bogus commit header check","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-26T21:50:34Z","receivedAt":"2010-05-26T21:50:34Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"daae1922 (fsck: check ident lines in commit objects, 2010-04-24)\ntaught fsck to expect commit objects to have the form\n\n  tree <object name>\n  <parents>\n  author <valid ident string>\n  committer <valid ident string>\n\n  log message\n\nThe check is overly strict: for example, it errors out with the\nmessage “expected blank line” for perfectly valid commits with an\n\"encoding ISO-8859-1\" line.\n\nLater it might make sense to teach fsck about the rest of the header\nand warn about unrecognized header lines, but for simplicity, let’s\naccept arbitrary trailing lines for now.\n\nReported-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nPatch is against jn/fsck-ident (daae1922).\n\nAs you might expect, this triggers for some real-world repos.\nMany thanks to Tuncer for the catch.\n\n fsck.c          |    2 --\n t/t1450-fsck.sh |    8 ++++++++\n 2 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/fsck.c b/fsck.c\nindex ae9ae1a..3d05d4a 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -311,8 +311,6 @@ static int fsck_commit(struct commit *commit, fsck_error error_func)\n \terr = fsck_ident(&buffer, &commit->object, error_func);\n \tif (err)\n \t\treturn err;\n-\tif (*buffer != '\\n')\n-\t\treturn error_func(&commit->object, FSCK_ERROR, \"invalid format - expected blank line\");\n \tif (!commit->tree)\n \t\treturn error_func(&commit->object, FSCK_ERROR, \"could not load commit's tree %s\", sha1_to_hex(tree_sha1));\n \ndiff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh\nindex 22a80c8..759cf12 100755\n--- a/t/t1450-fsck.sh\n+++ b/t/t1450-fsck.sh\n@@ -5,7 +5,9 @@ test_description='git fsck random collection of tests'\n . ./test-lib.sh\n \n test_expect_success setup '\n+\tgit config i18n.commitencoding ISO-8859-1 &&\n \ttest_commit A fileA one &&\n+\tgit config --unset i18n.commitencoding &&\n \tgit checkout HEAD^0 &&\n \ttest_commit B fileB two &&\n \tgit tag -d A B &&\n@@ -28,6 +30,12 @@ test_expect_success 'loose objects borrowed from alternate are not missing' '\n \t)\n '\n \n+test_expect_success 'valid objects appear valid' '\n+\t{ git fsck 2>out; true; } &&\n+\t! grep error out &&\n+\t! grep fatal out\n+'\n+\n # Corruption tests follow.  Make sure to remove all traces of the\n # specific corruption you test afterwards, lest a later test trip over\n # it.\n-- \n1.7.1.232.g3072.dirty\n"},{"id":"142510","messageId":"7vtypr5x85.fsf@alter.siamese.dyndns.org","threadId":"23918","inReplyTo":"20100526215034.GA6872@progeny.tock","subject":"Re: [PATCH] fsck: fix bogus commit header check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-05-29T01:10:34Z","receivedAt":"2010-05-29T01:10:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> daae1922 (fsck: check ident lines in commit objects, 2010-04-24)\n> taught fsck to expect commit objects to have the form\n>\n>   tree <object name>\n>   <parents>\n>   author <valid ident string>\n>   committer <valid ident string>\n>\n>   log message\n>\n> The check is overly strict: for example, it errors out with the\n> message “expected blank line” for perfectly valid commits with an\n> \"encoding ISO-8859-1\" line.\n> ...\n\nThanks.\n"}]}