Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Subversion handle file permissions and a .htaccess file?

Tags:

php

svn

apache

I'm using Subversion for one of my PHP projects. I have two questions/issues:

  1. How are file permissions handled with Subversion? If I have a file that I CHMOD to 755, and I check that file into the repository, will it have the same permissions when it's checked out into other working copies? If it does not copy, do I really need to change the permissions with every checkout?
  2. I have a .htaccess file that I don't want to check into the repository. If I do an update on a working copy that contains a .htaccess (but the repository doesn't have that file), will the file be deleted or will the update leave it alone?
like image 851
James Skidmore Avatar asked Aug 01 '09 02:08

James Skidmore


3 Answers

  1. The only permission Subversion knows about, is the executable bit, which is stored as a special "svn:executable" property. If this property is defined, the file is checked out with the exec bit set. For the rw flags, it depends on your umask. If your umask is for example 0022, a file without the svn:executable bit will be checked out with permission 0644. If your umask is 0002, the permission will be 0664. If svn:executable is set, the exec bit is set for the owner, group and everyone else.
  2. If you don't mark the .htaccess for addition (svn add), svn will leave the file alone. It will not go into the repo when committing, and it will not be deleted when you run svn update. You will see a "?" in front of it when you run "svn status".
like image 200
sunny256 Avatar answered Sep 30 '22 13:09

sunny256


  1. As already mentioned, SVN will not store permissions.

    The reason is trivial:

    The user who did the checkout will be owner of all files inside his working copy, so it does not make sense to give permissions as he already has read/write permissions on all files inside his working copy (depending on his umask).

    For executable flag set svn-property svn:executable.

  2. .htaccess file

    You should add the .htaccess to the parent directories svn:ignore property.

    However, SVN will never change or overwrite your changes without asking you first. So if some of your buddys will store the .accessfile into repository, SVN will stop update and will mention that your own .htaccess file must be removed to continue.

like image 39
Peter Parker Avatar answered Sep 30 '22 15:09

Peter Parker


For #2 you can simply add .htaccess to svn:ignore property. Here's a good take on what that does and how that work http://blog.bogojoker.com/2008/07/command-line-svnignore-a-file/ Permission-wise if you check out file it gets read/write permissions unless it's executable which should have svn:executable permissions and will be checked out as such. The file can also be explicitly marked with svn:needs-lock which then makes it read-only when you checkout

like image 27
Bostone Avatar answered Sep 30 '22 13:09

Bostone