]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fsck: move checks for gitattributes
authorPatrick Steinhardt <ps@pks.im>
Thu, 1 Dec 2022 14:46:05 +0000 (15:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Dec 2022 08:05:00 +0000 (17:05 +0900)
Move the checks for gitattributes so that they can be extended more
readily.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fsck.c

diff --git a/fsck.c b/fsck.c
index 4762ca9478a221be357db70ec0630a3b0424107a..3a7fb9ebbafb58001e2d7cc943006e0e8def2f67 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -614,17 +614,19 @@ static int fsck_tree(const struct object_id *tree_oid,
                                                 ".gitmodules is a symbolic link");
                }
 
+               if (is_hfs_dotgitattributes(name) || is_ntfs_dotgitattributes(name)) {
+                       if (S_ISLNK(mode))
+                               retval += report(options, tree_oid, OBJ_TREE,
+                                                FSCK_MSG_GITATTRIBUTES_SYMLINK,
+                                                ".gitattributes is a symlink");
+               }
+
                if (S_ISLNK(mode)) {
                        if (is_hfs_dotgitignore(name) ||
                            is_ntfs_dotgitignore(name))
                                retval += report(options, tree_oid, OBJ_TREE,
                                                 FSCK_MSG_GITIGNORE_SYMLINK,
                                                 ".gitignore is a symlink");
-                       if (is_hfs_dotgitattributes(name) ||
-                           is_ntfs_dotgitattributes(name))
-                               retval += report(options, tree_oid, OBJ_TREE,
-                                                FSCK_MSG_GITATTRIBUTES_SYMLINK,
-                                                ".gitattributes is a symlink");
                        if (is_hfs_dotmailmap(name) ||
                            is_ntfs_dotmailmap(name))
                                retval += report(options, tree_oid, OBJ_TREE,