2009-07-01 276 views
41

我使用Git版本1.5.6.3,这似乎混帐没有注意到一个文件夹的方式改变git如何处理文件夹权限?

#create a test repository with a folder with 777 mode 
:~$ mkdir -p test/folder 
:~$ touch test/folder/dummy.txt 
:~$ cd test 
:~/test$ chmod 777 folder/ 

#init git repository 
:~/test$ git init 
Initialized empty Git repository in ~/test/.git/ 
:~/test$ git add . 
:~/test$ git commit -m 'commit a directory' 
Created initial commit 9b6b21a: commit a directory 
0 files changed, 0 insertions(+), 0 deletions(-) 
create mode 100644 folder/dummy.txt 

#change folder permission to 744 
:~/test$ chmod 744 folder/ 
:~/test$ git status 
# On branch master 
nothing to commit (working directory clean) 

是什么04000立场?

:~/test$ git ls-tree HEAD folder 
040000 tree 726c1d5f0155771348ea2daee6239791f1cd7731 folder 

这是正常的行为吗?

如何跟踪文件夹模式更改?

+3

相关:http://stackoverflow.com/questions/737673/how-to-read-the-mode-field-of-git-ls-trees-output – 2009-07-01 20:37:33

回答

62

git跟踪的唯一'权限'位是文件的可执行位,其余模式位描述每个git树中对象的文件系统对象的类型。 git支持文件和符号链接(斑点),目录(树)和子模块(提交)。

git旨在帮助跟踪跨不同机器的源代码。权限位取决于机器之间的用户和组映射。在不存在这些映射的分布式环境中,跟踪权限位通常最终会阻碍事情而不是帮助任何事情。

如果您需要跟踪更多的文件系统属性git本机跟踪您可以考虑和扩展工具,如etckeeper