git-for-windows / git

A fork of Git containing Windows-specific patches.
http://gitforwindows.org/
Other
8.39k stars 2.55k forks source link

Make sure that the executable bit is handled properly #418

Closed dscho closed 2 years ago

dscho commented 9 years ago

In particular in cross-platform projects it is absolutely mandatory that Git for Windows leaves the executable bit alone.

Investigate where it is not left alone (user reports are quite fuzzy on this point) and fix it.

PhilipOakley commented 9 years ago

Hi dscho, some thoughts based on a recent 'problem' I had where I'd picked up a change during a patch series....

Ultimately I think I tied it down to git gui's stage/unstage functionality not playing well with msysgit(then) / g4w(now) and how it determined if the executable bit (mode) was to be handled / changed.

Essentialy (IIUC) the bash ls and the g4w handled the exe bit differently, with the gui losing the exe bit because it looked at what ls told it. (stage, unstage, restage a 'script' file (that starts with an 'x' mode) that has no .exe, .sh, or #! and the gui decides that it no longer has the 'x' mode)

On my very long list of nice to haves, is to add a detection in the git gui and gitk to flag changes of mode bits when the core filemode is false (IIRC), so at least those that use the tool will see the red warning that a mode changed (which is otherwise just another dull bit of text next to the file name that we glance past).

Certainly that fail mode would likely match the fuzzy user scenario.

See http://article.gmane.org/gmane.comp.version-control.msysgit/21723 - 3rd sentence of para starting "Grammatical corrections.."

Radrik5 commented 9 years ago

I reported the issue with changing executable bit to git mailing list: http://git.661346.n2.nabble.com/git-merge-changes-file-mode-from-644-to-755-td7637573.html I didn't have time to create a minimal reproducible example but I think the problem might be caused by rename detection. Stdafx.cpp files are usually have the same contents, so if some deleted stdafx.cpp had mode 755 and new stdafx.cpp with mode 644 have the same contents, on merge git may detect rename and change the file mode for some reason.

dscho commented 9 years ago

Good comments, both. This issue is a bit higher on my priority list, so I should be able to come up with MCVEs myself. Although... if you provided a reproducer, that would be most welcome ☺

Radrik5 commented 9 years ago

I cannot reproduce the merge problem with Git 2.5.3. Probably it was fixed somewhere between 1.9.5 and 2.5.3.

dscho commented 2 years ago

After almost 7 years, I have to admit to myself that I won't get around to fix this. It isn't critical enough of a problem to bubble up in my priority list anymore, certainly not since the default mode of git rebase uses cherry-picks instead of patches.