the book says:
Subversion uses the ignore patterns —- both the global
and the per-directory lists --
to determine which files should not be swept into the version
control system as part of a larger recursive addition or import operation.
When adding a recursive directory tree, we only heed the global ignores
list. Recall that the svn:ignore property is not inherited.
Subversion is adding the directory to version control, and immediately
proceeds to read the global ignores list, and the (obviously non-existent)
svn:ignore property of the new directory
How can a user specify a pattern using an svn:ignore property deep
inside a directory tree which is to be added? Isn't this a chicken-
and-egg problem? Are people supposed to use auto-props trickery for this?
I think the book is wrong there. It should make clear that only the
global ignores list is heeded.
My second question is due to a question in #svn.
A user noticed that svn add adds files and directories which are
explicitly mentioned on the command line, even if they match an svn:ignore
pattern (I've tested with 1.5.x, 1.6.x, and trunk). Why do we have an
--no-ignores option for svn add, documented as:
--no-ignore : disregard default and svn:ignore property ignores
but the default behaviour of 'svn add path' is to add the path even
if it is listed in the svn:ignore property of its parent directory?
I am leaning towards applying the patch below to fix this problem.
But I wanted to ask before committing this, in case I'm missing
something. This bug just seems too obvious :) Maybe there is a good
reason for the current behaviour?
(add): Don't add a path if its basename matches its dirname's
svn:ignore list, unless the --no-ignore option was passed.
--- subversion/libsvn_client/add.c (revision 905565)
+++ subversion/libsvn_client/add.c (working copy)
@@ -501,6 +501,20 @@ add(const char *local_abspath,
+ if (! no_ignore)
+ apr_array_header_t *ignores;
+ const char *dirname;
+ const char *basename;
+ dirname = svn_dirent_dirname(local_abspath, pool);
+ basename = svn_dirent_basename(local_abspath, pool);
+ SVN_ERR(svn_wc_get_ignores2(&ignores, ctx->wc_ctx, dirname,
+ ctx->config, pool, pool));
+ if (svn_wc_match_ignore_list(basename, ignores, pool))
+ return SVN_NO_ERROR;
SVN_ERR(svn_io_check_path(local_abspath, &kind, pool));
if (kind == svn_node_dir)
Received on 2010-02-02 17:16:50 CET