Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

filesystems - What is git's "filemode"?

What is git filemode? For me, it's in every repo's ./git/config file, near the top:

 [core]
    filemode = true

What is it? What does it mean? Does it bear any relation to

    bare = false

which I also don't really understand?

question from:https://stackoverflow.com/questions/19620335/what-is-gits-filemode

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

A git bare repo (detailed here) has no relation with filemode.
It is used for pushing to it, because since it has no working tree, there is no concern about maintaining said working tree in sync with what you just pushed.

what is a "fake" file? and what constitutes a "working" directory?

There is no "fake" file. It is just that a bare repo only contains git's administrative and control files, not actual data file you could work with and modify.
Those are checked out in a "working directory", when the repo is not bare.

The git config man page

core.fileMode

If false, the executable bit differences between the index and the working tree are ignored; useful on broken filesystems like FAT (File Allocation Table).
See git-update-index.

The command honors core.filemode configuration variable.
If your repository is on a filesystem whose executable bits are unreliable, this should be set to false.
This causes the command to ignore differences in file modes recorded in the index and the file mode on the filesystem if they differ only on executable bit.
On such an unfortunate filesystem, you may need to use git update-index --chmod=.

For me, it's in every repo's ./git/config file, near the top,

Me too, but on Windows, it is always:

git config --local core.filemode
false

Don't forget that git only records two filemodes:

  • 644
  • 755

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...