Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing file permissions in Subversion repository

How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write.

I looked on google and found a blog post from 2005 that states that Subversion doesn't store file-permissions. There are patches and hook-scripts listed (only one url still exists). Three years later does Subversion still not store file permissions and are hooks the only way to go about this? (I've never done hooks and rather use something that is native to Subversion.)

like image 682
graham.reeds Avatar asked Sep 11 '08 09:09

graham.reeds


People also ask

Does SVN store file permissions?

Subversion does not version permissions. There exist 2 wrapper scripts which you can use instead of “svn” for commit, checkout, update, etc., and store permissions in properties. They are: asvn and svn+perms.

How does SVN store files?

Subversion is a centralized system for sharing information. At its core is a repository, which is a central store of data. The repository stores information in the form of a filesystem tree - a typical hierarchy of files and directories.

How do I change permissions in SVN?

How to change default repository access permissions: Select the SVN repo you would like to protect directories within from the tools dropdown menu. Go to the Settings sub-tab on the SVN repository tab, then click the Protected Directories link on the left side.


2 Answers

SVN does have the capability of storing metadata (properties) along with a file. The properties are basically just key/value pairs, however there are some special keys like the 'svn:executable', if this property exists for a file, Subversion will set the filesystem's executable bit for that file when checking the file out. While I know this is not exactly what you are looking for it might just be enough (was for me).

There are other properties for line ending (svn:eol-style) and mime type(svn:mime-type).

like image 83
Richard Tasker Avatar answered Sep 22 '22 04:09

Richard Tasker


There's no native way to store file permissions in SVN.

Both asvn and the patch from that blog post seem to be up (and hosted on the official SVN repository), and that's a good thing, but I don't think they will have such metadata handling in the core version any time soon.

SVN has had the ability to handle symbolic links and executables specially for a long while, but neither work properly on Win32. I wouldn't hold my breath for another such non-portable feature (though it wouldn't be too hard to implement on top of the already existing metadata system.)

I would consider writing a shell script to manually adjust file permissions, then putting it in the repository.

like image 39
aib Avatar answered Sep 20 '22 04:09

aib