]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck: simplify ".git" check
authorJeff King <peff@peff.net>
Sun, 13 May 2018 16:35:37 +0000 (12:35 -0400)
committerJeff King <peff@peff.net>
Tue, 22 May 2018 03:55:12 +0000 (23:55 -0400)
There's no need for us to manually check for ".git"; it's a
subset of the other filesystem-specific tests. Dropping it
makes our code slightly shorter. More importantly, the
existing code may make a reader wonder why ".GIT" is not
covered here, and whether that is a bug (it isn't, as it's
also covered in the filesystem-specific tests).

Signed-off-by: Jeff King <peff@peff.net>
fsck.c

diff --git a/fsck.c b/fsck.c
index 5c8c12dde381912eccf59bbf3ed8c774344809b8..f7be966bdebd732886128d1dad4a4f3cbb538040 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -561,9 +561,7 @@ static int fsck_tree(struct tree *item, struct fsck_options *options)
                has_empty_name |= !*name;
                has_dot |= !strcmp(name, ".");
                has_dotdot |= !strcmp(name, "..");
-               has_dotgit |= (!strcmp(name, ".git") ||
-                              is_hfs_dotgit(name) ||
-                              is_ntfs_dotgit(name));
+               has_dotgit |= is_hfs_dotgit(name) || is_ntfs_dotgit(name);
                has_zero_pad |= *(char *)desc.buffer == '0';
                if (update_tree_entry_gently(&desc)) {
                        retval += report(options, &item->object, FSCK_MSG_BAD_TREE, "cannot be parsed as a tree");