Skip to content

Commit ed9c322

Browse files
committed
fsck: simplify ".git" check
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 <[email protected]>
1 parent db5a58c commit ed9c322

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fsck.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,7 @@ static int fsck_tree(struct tree *item, struct fsck_options *options)
561561
has_empty_name |= !*name;
562562
has_dot |= !strcmp(name, ".");
563563
has_dotdot |= !strcmp(name, "..");
564-
has_dotgit |= (!strcmp(name, ".git") ||
565-
is_hfs_dotgit(name) ||
566-
is_ntfs_dotgit(name));
564+
has_dotgit |= is_hfs_dotgit(name) || is_ntfs_dotgit(name);
567565
has_zero_pad |= *(char *)desc.buffer == '0';
568566
if (update_tree_entry_gently(&desc)) {
569567
retval += report(options, &item->object, FSCK_MSG_BAD_TREE, "cannot be parsed as a tree");

0 commit comments

Comments
 (0)