How to get SVN to ignore a directory inside an externals definition How to get SVN to ignore a directory inside an externals definition wordpress wordpress

How to get SVN to ignore a directory inside an externals definition


What you’re really asking is, “Can you specify --depth for svn:externals” and the answer is no. Externals currently are fully recursive on the specified directory.

Issue 3216 requests this functionality, but it doesn’t look like it’s coming any time soon.


You could make separate externals to each subfolder within the referenced repository. So if your external is to a repo with projects A, B, and C and you only want A and B then you can make two separate external reference to the subfolders for A and B individually.

Currently I'm doing this with a project but you can run into problems if you are actually making edits to the externals and committing them since changes in two separate externals cannot be committed atomicly. This problem exists even if the two externals actually point to the same repository which makes sense but is important to note when using this technique.

Also if you are responsible for the second repository, one option is also to tuck testing, documentation and other related folders into a yet another separate repository with externals to the source code in order to separate them from the main code repository. This way these folders won't be pulled in when making an external reference because of code dependencies.


You can do this with sparse directories (also known as shallow checkouts). I am not 100% sure it works when using externals, but I don't see why it wouldn't.