新檔案模式 100644 這 100 在這里。我知道最后三個數字的含義。但不是這種檔案模式的意思。請給我有關的所有資訊。我喜歡充分了解情況。
我嘗試搜索有關此檔案模式的資訊,但僅獲取有關檔案權限的資訊,而不是有關此檔案模式的資訊。
uj5u.com熱心網友回復:
根據git 檔案:
代碼是以八進制表示的一系列位,從大到小
- 4位檔案型別
- 1000 - 常規檔案
- 1010 - 符號鏈接
- 1110 - 混帳鏈接
- 3 個未使用的位
- 9 位權限(僅限 644 或 755)
所以你的例子100644翻譯成二進制
001 000 000 110 100 100
檔案型別:1000 - 常規檔案
未使用位:000
權限:110 100 100 - 644
看起來樹也獲得了沒有權限的型別代碼 0100,盡管我沒有看到檔案中指定的內容。
uj5u.com熱心網友回復:
Git 樹物件中的一個條目只能有五種不同的“檔案模式”。例如,我當前的 Git 源代碼包含這些條目以及許多其他條目:
040000 tree fe75d26ce528361a9ef3063415db408a7a1ca189 Documentation
120000 blob 81052262e0e43711f308ebc67a371def932cdccc RelNotes
100755 blob 205541e0f7f81b1df4061215ae34a2742a45475d generate-cmdlist.sh
100644 blob a25940d72e84e1ad6daba76a6c2845f320bc4df3 git.c
160000 commit 855827c583bc30645ba427885caa40c5b81764d2 sha1collisiondetection
模式是
100644對于常規檔案100755對于可執行檔案040000對于子樹(目錄)120000對于符號鏈接160000對于子模塊
Git 的作者可以選擇任何文本標記來識別這五種模式,但出于歷史原因,他們選擇將它們撰寫為與C 代碼中st_mode的 a相同的值,寫為八進制值。struct stat這種任意選擇的證明是該值160000永遠不會出現在 a 中struct stat(這將是S_IFDIR|S_IFLNK,在行為良好的系統上是不可能的)。
uj5u.com熱心網友回復:
似乎檔案模式是指可執行位(而不是所有權限)
不建議使用 core.fileMode。它只是解決模式的可執行位,而不是讀/寫位。
根據Git-Config的檔案
core.fileMode
Tells Git if the executable bit of files in the working tree is to be honored.
Some filesystems lose the executable bit when a file that is marked as executable is checked out, or checks out a non-executable file with executable bit on. git-clone[1] or git-init[1] probe the filesystem to see if it handles the executable bit correctly and this variable is automatically set as necessary.
A repository, however, may be on a filesystem that handles the filemode correctly, and this variable is set to true when created, but later may be made accessible from another environment that loses the filemode (e.g. exporting ext4 via CIFS mount, visiting a Cygwin created repository with Git for Windows or Eclipse). In such a case it may be necessary to set this variable to false. See git-update-index[1].
The default is true (when core.filemode is not specified in the config file).
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/453500.html
