如果我git ls-tree branchname path/to/directory得到以下输出:

100644 blob d7cf85396913fb7169a881d8334f32af153122eb    .gitignore
100644 blob ba7adb479be66d8f1d62384ab53997cddd465110    .travis.yml
040000 tree 2de254bbec97958db2375e2d0ab767b23315ab50    application

因此,我看到了以下权限集:
100644 for blobs, 040000 for trees

根据我所读的100644可以解释为-regular file with sticky bit of 0 and file permissions of 644 (not executable by anyone)040000-directory with sticky bit of 0 and no permissions。与blob的644不同,755也是可能的,因为我读过的git只跟踪可执行位。
我的问题是git究竟如何使用这些权限?签出分支时,是否将它们应用于工作树中的文件和文件夹?还是在内部使用它们?
请注意,这个问题不是关于这些权限代表什么。

最佳答案

git使用这些权限来确定签出时目录项的类型,并在必要时设置执行权限标志。据我所知,它们并没有以任何其他方式使用。
在git中,文件模式比标准posix文件系统中少:
100644:普通文件
100755:可执行文件
040000:目录
120000:符号链接

07-24 09:45
查看更多