2009-07-01 124 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