git bridge changes git filemode without asking.
Steps to Reproduce
- Commit a file to a github repository that has filemode 100755
- Open the repository in overleaf and save any file, not the 100755 file.
- Behold that the file previously 100755 is now 100644
Expected Behaviour
The unmodified file should remain unmodified. The filemode should not change unless requested.
Observed Behaviour
The previously-executable file is now 100644, not executable.
Context
One of my collaborators uses overleaf to edit papers, while the rest of us use native editors and a local latex installation. When we write papers we often include executable scripts take data and generate figures, using a makefile.
Whenever he merges, exectuable files are made no longer executable. That is, git's file permissions change from 100755 to 100644. This breaks everybody else's compilation, as the scripts can no longer be run to generate figures.
I contacted overleaf support on 14 June suggesting Overleaf set git core.fileMode = False and on 15 June got a response:
Thanks for getting in touch, and sorry that you and your colleagues are having problems with this.
This is a known issue with executable files within a project. Unfortunately, the solution that you are proposing can't be directly applied on the Overleaf side: Overleaf is not running a git repository, so can't apply this setting. T he feature that you are using to connect to the Overleaf project is actually a git-bridge that maps the GIT API onto Overleaf's internal source control management system, which is not quite the same as GIT.
It may be helpful, however, as suggested in the documentation that you provided, to set core.fileMode = false on your end. This has proven to be a viable workaround for other users who have reported this.
- In the affected project, run:
git config core.fileMode false
This will change the setting for the repo only, it doesn't affect the system-wide or local (per-user) git configs unless you add flags to the command as such.
- Then use chmod to restore the execute permission to any affected files.
Files with the execute bit set will not have it overwritten by pulling from Overleaf, unless you edit the file itself in Overleaf.
I responded
We will implement this temporary fix as you suggest, but I consider this a bug with the overleaf git-bridge, and I hope you do too. It causes a possibly-breaking change the user did not ask for.
We generally want git to track the filemode, which is why generally setting core.fileMode=false is not an acceptable long-term workaround. Otherwise, different users' modes may fall out of sync. To produce our manuscript we have scr ipts that read data and produce figures, for example. We do not want to store the figures themselves in the repository---we want to store the data and the scripts that produce them. Those scripts must be executable; if they are not, t he figures will not be produced and make will fail. Requiring the user to remember to force git to update the permissions on each new figure script they write is a recipe for disaster.
but never heard back, so I am opening an issue here because---surprise!---this issue just bit us again as we prepare another paper.
Source: overleaf/overleaf