git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] git-fsck: report missing author/commit line in a commit as an error
@ 2008-02-03 21:22 Martin Koegler
  2008-02-03 21:22 ` [PATCH 2/3] fsck_commit: remove duplicate tests Martin Koegler
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Koegler @ 2008-02-03 21:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Martin Koegler

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>
---
 builtin-fsck.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtin-fsck.c b/builtin-fsck.c
index 6fc9525..cc7524b 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;
 }
 
-- 
1.5.4.g22bc

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-02-04  7:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-03 21:22 [PATCH 1/3] git-fsck: report missing author/commit line in a commit as an error Martin Koegler
2008-02-03 21:22 ` [PATCH 2/3] fsck_commit: remove duplicate tests Martin Koegler
2008-02-03 21:22   ` [PATCH 3/3] parse_object_buffer: don't ignore errors from the object specific parsing functions Martin Koegler
2008-02-03 23:58   ` [PATCH 2/3] fsck_commit: remove duplicate tests Junio C Hamano
2008-02-04  0:04     ` Johannes Schindelin
2008-02-04  7:06       ` Martin Koegler
2008-02-04  7:33         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).