Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cygwin git thinks that file previously had different mode

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.

like image 218
dhblah Avatar asked Oct 28 '13 12:10

dhblah


1 Answers

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.

like image 151
Sean Avatar answered Oct 05 '22 01:10

Sean