wesley tanaka

recursively ignoring a filename or pattern with svn

‹ Image Spam CAPTCHAs | The Poisonwood Bible ›
()

(was: "getting svn to ignore tags files")

I wanted to ignore all "tags" files in a particular subversion project, but I couldn't find a way to apply an ignore pattern recursively to all subdirectories within a certain directory.

Options which don't work for me:

  • It's possible to add tags to the global-ignores config setting in $HOME/.subversion/config, but the problem with that is it's not shared across different working copies of the project on different computers. I tried adding $HOME/.subversion to revision control, but that didn't work because I couldn't check it out on any other computer.
  • It's also possible to do a svn propset -R svn:ignore tags . in the base directory in which I recursively want to ignore tags files. That unfortunately has the side-effect of clobbering any previous svn:ignore setting in all subdirectories.
So I resorted to doing it outside of the subversion executable. The following command seems to work (it's supposed to append tags to the end of the svn:ignore property in all subdirectories of the current directory)
find . -type d \! -path \*.svn\* | while read DIR; do
OLDIGNORE="`svn propget svn:ignore \"$DIR\"`"
svn propset svn:ignore "`echo \"$OLDIGNORE\"; echo 'tags'`" "$DIR"
done

Suggested Links

Syndicate content