summaryrefslogtreecommitdiff
path: root/fsck.c
diff options
context:
space:
mode:
Diffstat (limited to 'fsck.c')
-rw-r--r--fsck.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/fsck.c b/fsck.c
index 1523243..e41e753 100644
--- a/fsck.c
+++ b/fsck.c
@@ -527,8 +527,8 @@ static int fsck_tree(struct tree *item, struct fsck_options *options)
return retval;
}
-static int require_end_of_header(const void *data, unsigned long size,
- struct object *obj, struct fsck_options *options)
+static int verify_headers(const void *data, unsigned long size,
+ struct object *obj, struct fsck_options *options)
{
const char *buffer = (const char *)data;
unsigned long i;
@@ -545,6 +545,15 @@ static int require_end_of_header(const void *data, unsigned long size,
}
}
+ /*
+ * We did not find double-LF that separates the header
+ * and the body. Not having a body is not a crime but
+ * we do want to see the terminating LF for the last header
+ * line.
+ */
+ if (size && buffer[size - 1] == '\n')
+ return 0;
+
return report(options, obj,
FSCK_MSG_UNTERMINATED_HEADER, "unterminated header");
}
@@ -601,7 +610,7 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer,
unsigned parent_count, parent_line_count = 0, author_count;
int err;
- if (require_end_of_header(buffer, size, &commit->object, options))
+ if (verify_headers(buffer, size, &commit->object, options))
return -1;
if (!skip_prefix(buffer, "tree ", &buffer))
@@ -702,7 +711,7 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
}
}
- if (require_end_of_header(buffer, size, &tag->object, options))
+ if (verify_headers(buffer, size, &tag->object, options))
goto done;
if (!skip_prefix(buffer, "object ", &buffer)) {