Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default permissions when Mercurial creates files

Tags:

mercurial

If Mercurial does not track file permissions by default, how does it decide on the permissions for any files/directories it creates?

Does it use umask? If not, what does it use?

I have read in the mail list the following:

Mercurial uses the mode of the .hg/store directory to compute a mask

but this seems a bit arbitrary (if there is any explanation behind it, I'd love to hear it). Is this explained in the documentation?

like image 292
Amelio Vazquez-Reina Avatar asked Dec 17 '11 21:12

Amelio Vazquez-Reina


1 Answers

There doesn't seem to be any complete explanation, only a mention of it in the "How To Handle Multiple Committers" page:

If you are using a version of Mercurial older than 1.0, it's important that each user's umask be set to 002 or something similar. If it's set to 022, group write privileges will be masked off for files that users create, causing other users to be unable to modify them.

You can change the default umask for a user by editing their ~/.profile and adding the line...

umask 002

Alternatively, you can edit /etc/profile to change the system-wide settings.
Changing the /etc/profile will not work if people check in stuff with the hg command, as that file isn't read by non-interactive shells, /etc/bash.bashrc is a better place to put the system-wide settings.

Otherwise since Mercurial 1.0, the default permission is inherited from .hg/store.

like image 69
VonC Avatar answered Oct 04 '22 17:10

VonC