From the Git index-format.txt
file, regarding the mode:
32-bit mode, split into (high to low bits)
4-bit object type
valid values in binary are 1000 (regular file), 1010 (symbolic link)
and 1110 (gitlink)
3-bit unused
9-bit unix permission. Only 0755 and 0644 are valid for regular files.
Symbolic links and gitlinks have value 0 in this field.
Also, a directory object type (binary 0100) and group-writeable (0664 permissions) regular file are allowed as indicated by the fsck.c
fsck_tree
method. The regular non-executable group-writeable file is a non-standard mode that was supported in earlier versions of Git.
This makes valid modes (as binary and octal):
0100000000000000
(040000
): Directory
1000000110100100
(100644
): Regular non-executable file
1000000110110100
(100664
): Regular non-executable group-writeable file
1000000111101101
(100755
): Regular executable file
1010000000000000
(120000
): Symbolic link
1110000000000000
(160000
): Gitlink
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…