How to make SVN ADD ignore binary files

There is no extension in binaries (for Linux), so I cannot exclude them using templates. That way, when I use SVN add to add a directory, I get something like

 $ svn add recursion_vector/ A recursion_vector A recursion_vector/rec_vec.cxx A recursion_vector/rec_vec.h A (bin) recursion_vector/rec_vec 

Here rec_vec is the executable I would like to exclude. SVN obviously recognizes it as binary. Now can I tell Subversion to ignore all binaries?

+6
directory svn binary ignore add
source share
3 answers

This is a bit verbose as it uses find:

find [TARGET-DIRECTORY] \( -executable -type f \) -prune -o -print | xargs svn add --depth empty

Passing the target directory to search, find will overwrite the directory that prints all the contents except for executable files ( \( -executable -type f \) -prune ). Without -type f find will also clip directories, as they usually have an execution bit or a search bit.

The --depth empty to add indicates svn is not a recursive file object itself, since find handles recursion.

If you like the result, you can put it in a shell function that allows you to pass arguments to [TARGET-DIRECTORY] .

Thanks,

Zachary

+2
source share

Can you match patterns to exclude file names that do not exist . ?

+1
source share

This is not exactly what you want (and you already know this answer) ... but anyway:

You can set exception patterns to ignore some files based on file names. Additional information in the big SVN book:

http://svnbook.red-bean.com/en/1.1/ch07s02.html#svn-ch-7-sect-2.3.3

Other than that, maybe something can be done with commit commit, but I have no experience with these ...

Good luck

0
source share

All Articles