cygwin git thinks that file previously had different mode

青春壹個敷衍的年華 提交于 2019-12-10 17:17:55

问题


I manually built latest version of git for cygwin. The only problem is that it thinks that file mode changed (from 644 to 755). Git that is installed in windows doesn't see any changes. actual file mode is 755 (both windows Git and cygwin git shows the same).

So, as a result, 1) on windows git doesn't show any changes whether core.filemode is set to true or false 2) on cygwin git shows changes for modes if core.filemode is set to true or unset and doesn't show any changes when core.filemode is set to false Actual file mode is 755.

So, my question is, is there a bug(featue) in windows git (msysgit) that emulates core.filemode = false disregarding of option set. Or does cygwin git displays wrong previous file mode. I suppose it's the first, as files are of xml type.


回答1:


mysysgit doesn't support file permissions well. It assumes all .exe is 755 and all text is 644. In my experience, I always have filemode=false in the global config for mysysgit.

Using a separate global config for cygwin which has filemode=true since cygwin supports chmod and you can track the executable bit as needed, but you'd have to commit changes to it from cygwin.

I also noticed, when you clone or init a repo in cygwin, it automatically adds core.filemode=true to the local config, which has precedence over global, which will break my suggestion above.

I was able to fix this by git config --local -e and deleting the filemode entry, leaving the global config as the only definition to use.

The downside is every repo you clone will have it set to true, so you'll need to delete it out of there per repo. I haven't found a way to prevent this on cygwin.



来源:https://stackoverflow.com/questions/19635461/cygwin-git-thinks-that-file-previously-had-different-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!