summaryrefslogtreecommitdiff
path: root/builtin-fsck.c
diff options
context:
space:
mode:
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>2008-02-03 21:22:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-04 00:04:56 (GMT)
commitd4fe07f14975b87fa26776792a95f411473cfb46 (patch)
tree4cd03f52082ccf42132bdb1bcc67eb32d018c523 /builtin-fsck.c
parent3023448cef6e85bdc1ce98226f23d63128c5c9a1 (diff)
downloadgit-d4fe07f14975b87fa26776792a95f411473cfb46.zip
git-d4fe07f14975b87fa26776792a95f411473cfb46.tar.gz
git-d4fe07f14975b87fa26776792a95f411473cfb46.tar.bz2
git-fsck: report missing author/commit line in a commit as an error
A zero commit date could be caused by: * a missing author line * a missing commiter line * a malformed email address in the commiter line * a malformed commit date Simply reporting it as zero commit date is missleading. Additionally, it upgrades the message to an error (instead of an printf). Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-fsck.c')
-rw-r--r--builtin-fsck.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 2a6e94d..8c56434 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -360,6 +360,9 @@ static int fsck_commit(struct commit *commit)
fprintf(stderr, "Checking commit %s\n",
sha1_to_hex(commit->object.sha1));
+ if (!commit->date)
+ return objerror(&commit->object, "invalid author/committer line");
+
if (memcmp(buffer, "tree ", 5))
return objerror(&commit->object, "invalid format - expected 'tree' line");
if (get_sha1_hex(buffer+5, tree_sha1) || buffer[45] != '\n')
@@ -378,9 +381,6 @@ static int fsck_commit(struct commit *commit)
return objerror(&commit->object, "could not load commit's tree %s", tree_sha1);
if (!commit->parents && show_root)
printf("root %s\n", sha1_to_hex(commit->object.sha1));
- if (!commit->date)
- printf("bad commit date in %s\n",
- sha1_to_hex(commit->object.sha1));
return 0;
}