]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-fsck.c
Merge branch 'pb/prepare-commit-msg'
[git.git] / builtin-fsck.c
index 6fc9525e0485f3dba00fa6bea8df1479221f0ce0..cc7524be80f51bca45ef8a205900cf50135bfc5d 100644 (file)
@@ -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;
 }