117

I have a few files that have been executable before svn adding them. They have the svn:executable property set. Now, a few other files were checked in without the executable bit do not have it, and I want to set the svn:executable property:

$ svn propset svn:executable on *.cgi

Then I check the status and even the files with the svn:executable have been modified:

$ svn diff
Property changes on: a.cgi
___________________________________________________________________
Modified: svn:executable
   - 
   + *


Property changes on: b.cgi
___________________________________________________________________
Added: svn:executable
   + *

a.cgi should not be modified. I want to add the svn:executable bit to be set in the same way as it is on the other files, but can't figure out the command to do it.

Jake
  • 1,171
  • 2
  • 8
  • 4
  • 2
    I open this page every time I don't want to type `svn propset svn:executable on (...)`. And the answer to the question should be `for f in *.cgi; do if [ ! -x $f ]; then svn ps (...); fi; done`, and just commit the modified files. Then move on. – Tomasz Gandor Nov 23 '13 at 05:32
  • @TomaszGandor Think you're missing `svn:executable` somewhere in that second snippet. Maybe `svn ps svn:executable on $f;`? – Keith M Jun 22 '17 at 23:28
  • 1
    https://en.wikipedia.org/wiki/Ellipsis_(linguistics) - yes, it was left as an exercise to the reader. – Tomasz Gandor Jun 23 '17 at 00:27
  • if you subsequently ran `svn st -uq` you'd see only the changes – pstanton Apr 27 '22 at 00:31

2 Answers2

179

You are right to use the svn property editing commands. The property is svn:executable.

To add the "executable bit" in svn

svn propset svn:executable on <list of files>

To remove the "executable bit" in svn

svn propdel svn:executable <list of files>

The SVN documentation for this is located here.

As far as not modifying the executables, you are not modifying the executable (a checksum will verify that), but you are modifying the SVN repository. Remember that SVN revisions file systems, not just files; so, a modification of the permission bits will increase the SVN revision number, even if it's just a modification of a file's properties (and not a modification of the file itself).

Gray
  • 115,027
  • 24
  • 293
  • 354
Edwin Buck
  • 69,361
  • 7
  • 100
  • 138
  • When I run svn propset in the way shown above, it sets them to "*" but the natural way sets svn:executable to nothing, but which is still set. I want this property to be the same as the ones whose executable bit was set before adding them to subversion. – Jake Apr 22 '11 at 16:11
  • 2
    Sorry for all the edits, but if I recall correctly, having it set to anything will turn on the executable bit, deleting it (and possibly setting it to null or whitespace) will turn it off. To get the value your SVN client was using, a svn propget can be used. – Edwin Buck Apr 22 '11 at 16:15
-1

Here is how I set the executable property on all the *.py files in my project that have execute bit set on them. I execute this from the top level directory

for f in `find ./ -name '*.py'`; do echo $f; if [ -x $f ]; then echo $f 'is executable setting svn:executable'; svn propset svn:executable on $f; else echo $f 'is not executable'; fi; done;
Isaac Jessop
  • 110
  • 7
  • How does the executable attribute get set without using propset? I didn't use it, and to the the best of my knowledge, nobody else did either. It appears on three files in the same directory and nowhere else, and there seems to be nothing special about those files. (They're java files, not sh or exe or bat or jar or whatever.) – Jerry Miller Oct 18 '18 at 18:51
  • I believe if the file has the executable bit set when it is initially imported then the svn executable property will be set. – Isaac Jessop Oct 20 '18 at 12:49
  • pretty sure find has a -perm switch which might be slightly more elegant than the if/then but of course it would be more to remember – Never Sleep Again Jul 31 '20 at 17:27