Skip to content

Commit 79b1138

Browse files
committed
fsck.c: fix bogus "empty tree" check
ba002f3 (builtin-fsck: move common object checking code to fsck.c) did more than what it claimed to. Most notably, it wrongly made an empty tree object an error by pretending to only move code from fsck_tree() in builtin-fsck.c to fsck_tree() in fsck.c, but in fact adding a bogus check to barf on an empty tree. An empty tree object is _unusual_. Recent porcelains try reasonably hard not to let the user create a commit that contains such a tree. Perhaps warning about them in git-fsck may have some merit. HOWEVER. Being unusual and being errorneous are two quite different things. This is especially true now we seem to use the same fsck_$object() code in places other than git-fsck itself. For example, receive-pack should not reject unusual objects, even if it would be a good idea to tighten it to reject incorrect ones. Signed-off-by: Junio C Hamano <[email protected]>
1 parent c95b3ad commit 79b1138

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

fsck.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
155155
o_mode = 0;
156156
o_name = NULL;
157157
o_sha1 = NULL;
158-
if (!desc.size)
159-
return error_func(&item->object, FSCK_ERROR, "empty tree");
160158

161159
while (desc.size) {
162160
unsigned mode;

0 commit comments

Comments
 (0)