You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Eric Gillespie ep...@pretzelnet.org on 2003/01/22 22:41:37 UTC
svn add horkage (and exposing libsvn_wc's ignore functionality)
So i see svn add is now recursive by default. While it surprised
me at first since i wanted and expected non-recursive behavior,
this is probably how it should be. Most people probably want it
that way most of the time, and maybe i do too. However, i think
it is misbehaving:
0 ~% svn add thing
A thing
A thing/test
A thing/test/Makefile
A thing/test/Makefile.in
A thing/test/gettty.c
A thing/test/strings-memmove.c
A thing/.libs
A (bin) thing/.libs/librxvt.a
A thing/.libs/librxvt.lai
A thing/.libs/librxvt.la
A thing/graphics
A thing/graphics/Makefile
A thing/graphics/Makefile.in
A thing/graphics/README
A thing/graphics/data
A thing/graphics/grxlib.c
A thing/graphics/grxlib.h
A thing/graphics/qplot.c
A thing/command.c
A thing/command.h
A thing/defaultfont.c
A thing/defaultfont.h
A thing/feature.h
A thing/gcc-Wall
A thing/graphics.c
A thing/grkelot.c
A thing/grkelot.h
A thing/init.c
A thing/init.h
A thing/logging.c
A thing/logging.h
A thing/main.c
A thing/makeextprotos-awk
A thing/makeextprotos-sed
A thing/makeintprotos-awk
A thing/makeintprotos-sed
A thing/menubar.c
A thing/misc.c
A thing/menubar.h
A thing/netdisp.c
A thing/netdisp.h
A thing/protos.h
A thing/ptytty.c
A thing/rxvt.c
A thing/rxvt.h
A thing/rxvtgrx.h
A thing/rxvtlib.h.in
A thing/screen.c
A thing/scrollbar-next.c
A thing/scrollbar-rxvt.c
A thing/scrollbar-xterm.c
A thing/scrollbar.c
A thing/strings.c
A thing/version.h
A thing/xdefaults.c
A thing/xpm.c
A thing/Makefile
A thing/rxvtlib.h
A thing/logging.extpro
A thing/init.extpro
A thing/command.extpro
A thing/defaultfont.extpro
A thing/graphics.extpro
A thing/grkelot.extpro
A thing/menubar.extpro
A thing/main.extpro
A thing/netdisp.extpro
A thing/misc.extpro
A thing/scrollbar.extpro
A thing/ptytty.extpro
A thing/screen.extpro
A thing/.protos
A (bin) thing/rxvt.o
A thing/scrollbar-rxvt.extpro
A thing/scrollbar-next.extpro
A thing/scrollbar-xterm.extpro
A thing/strings.extpro
A thing/xdefaults.extpro
A thing/xpm.extpro
A (bin) thing/command.o
A thing/command.lo
A thing/command.intpro
A (bin) thing/defaultfont.o
A thing/defaultfont.intpro
A thing/defaultfont.lo
A (bin) thing/init.o
A thing/init.intpro
A thing/init.lo
A (bin) thing/graphics.o
A thing/graphics.intpro
A thing/graphics.lo
A thing/logging.intpro
A (bin) thing/main.o
A thing/main.intpro
A thing/main.lo
A (bin) thing/menubar.o
A thing/menubar.intpro
A thing/menubar.lo
A (bin) thing/misc.o
A thing/misc.intpro
A thing/misc.lo
A (bin) thing/netdisp.o
A thing/netdisp.intpro
A thing/netdisp.lo
A (bin) thing/ptytty.o
A thing/ptytty.intpro
A thing/ptytty.lo
A (bin) thing/screen.o
A thing/screen.intpro
A thing/screen.lo
A (bin) thing/scrollbar.o
A thing/scrollbar.intpro
A thing/scrollbar.lo
A (bin) thing/scrollbar-rxvt.o
A thing/scrollbar-rxvt.intpro
A thing/scrollbar-rxvt.lo
A (bin) thing/scrollbar-next.o
A thing/scrollbar-next.intpro
A thing/scrollbar-next.lo
A (bin) thing/xdefaults.o
A (bin) thing/scrollbar-xterm.o
A thing/scrollbar-xterm.intpro
A thing/scrollbar-xterm.lo
A thing/xdefaults.lo
A thing/xdefaults.intpro
A (bin) thing/xpm.o
A thing/xpm.intpro
A thing/xpm.lo
A thing/librxvt.la
A (bin) thing/rxvt
A thing/.indent.pro
A thing/Makefile.in
I have many of those files in global-ignores:
global-ignores = *.o *.lo *.la *.al .libs .so* .a #*# .*.rej *.rej .*~ *~ .#*
svn add should not add those files.
Well, i was going to have a patch with this message, but it looks
like the ignore functionality is completely hidden in libsvn_wc.
It looks like it was expected that only svn status would need
this functionality. At least some of it should be exposed.
I was going to add a test to see if the item is to be ignored in
libsvn_client/add.c:add_dir_recursive right after the check for
'.svn', '.', and '..'. But to do that i need a function like
svn_wc_is_ignored.
Of course, another way to do it would be to have svn_wc_add call
get_default_ignores and check for this itself. But that seems
the wrong place to do it, to me. Furthermore, i still think
libsvn_wc should expose the ignore functionality. Even if it
turns out the svn program never does anything with it, other
clients may find it useful.
How does that sound?
--
Eric Gillespie, Jr. * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Branko Čibej br...@xbc.nu.
Karl Fogel wrote:
Branko Čibej brane@xbc.nu writes:
Please, no. svn_config reads configuration, yes, but it doesn't
interpret it. Putting this in svn_config breaks our interface
separation. The ability to ignore files is a feature of the working copy
(not even of the client!), so that get_default_ignores should go into
svn_wc.
That was my original argument to myself about why it shouldn't go into
svn_config. But then I thought: it's *not* interpreting it. The new
interface has one function to retrieve a specific config value as a
list, and another function to tell you if a specific pattern is in the
list. Both of these are simply more fine-grained versions of what we
already do in svn_config. The config interface already reads file
data into a structure, and then provides functions to get bits of that
data out of the structure.
O.K., then let's instead get a generic interface for parsing option
values into lists of thingies. In other words, let's not call it get
ignore pattens, so that we can use the function for other listy
options, too.
How a caller uses the data is another matter, of course. It's not
svn_config that's actually ignoring the files, it's still svn_wc.
Sure, that's why svn_config shouldn't be saying out loud that it's
retrieving a list of things to ignore.
If you want to move it, that's fine. Actually, my alternative was to
put it in svn_client, since client implementations might want to know
if a file is in the ignore space or not. But heck, svn_wc works too.
I don't see a clear right answer here; we could also wait until
calling patterns make it clear, and then move it.
I'd say svn_client +0, svn_wc +1, svn_config -0.6931
--
Brane Čibej brane@xbc.nu http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Eric Gillespie epg@pretzelnet.org writes:
If you want to move it, that's fine. Actually, my alternative was to
put it in svn_client, since client implementations might want to know
if a file is in the ignore space or not. But heck, svn_wc works too.
I don't see a clear right answer here; we could also wait until
calling patterns make it clear, and then move it.
Discussion seems to have died out without a conclusion. Which
is it going to be?
I think it was just being left to your discretion, as the discussion
made everyone's thoughts known and also made it clear that no one was
vetoing anything.
If you'd like something a little more concrete than that, though :-),
I'd say go with libsvn_client, as I suspect other clients will want to
access this functionality. (Brane leaned most strongly toward
libsvn_wc, so if libsvn_client makes you queasy, do wc instead.)
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Eric Gillespie <ep...@pretzelnet.org> writes:
> > If you want to move it, that's fine. Actually, my alternative was to
> > put it in svn_client, since client implementations might want to know
> > if a file is in the ignore space or not. But heck, svn_wc works too.
> > I don't see a clear right answer here; we could also wait until
> > calling patterns make it clear, and then move it.
>
> Discussion seems to have died out without a conclusion. Which
> is it going to be?
I think it was just being left to your discretion, as the discussion
made everyone's thoughts known and also made it clear that no one was
vetoing anything.
If you'd like something a little more concrete than that, though :-),
I'd say go with libsvn_client, as I suspect other clients will want to
access this functionality. (Brane leaned most strongly toward
libsvn_wc, so if libsvn_client makes you queasy, do wc instead.)
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
[PATCH] svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie <ep...@pretzelnet.org>.
Here is the final (hehe) version of the patch:
A recursive svn add was scheduling items matching the user's ignore
list for addition. Export svn_wc's ignores functionality and use that
in svn_client to correct this.
* subversion/include/svn_wc.h:
Add prototypes and documentation for svn_wc_get_default_ignores and
svn_wc_is_ignored.
* subversion/libsvn_client/add.c:
(add_dir_recursive): Use svn_wc_is_ignored to avoid adding items
matching the user's ignore list.
* subversion/libsvn_wc/status.c:
(get_default_ignores): Renamed to svn_wc_get_default_ignores.
(svn_wc_is_ignored): New function, basically copied from the check
in add_unversioned_items.
(add_unversioned_items): Use svn_wc_is_ignored.
(get_dir_status): Use svn_wc_get_default_ignores.
* subversion/tests/clients/cmdline/basic_tests.py:
(basic_add_ignores): Regression test for this bug.
(test_list): Run it.
Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h (revision 4726)
+++ subversion/include/svn_wc.h (working copy)
@@ -2022,6 +2022,20 @@
apr_pool_t *pool);
+/** Get the run-time configured list of ignore patterns, and store
+ * them in @a patterns. Allocate @a patterns and its contents in @a
+ * pool.
+ */
+svn_error_t *svn_wc_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool);
+
+/** Determine whether a @a path matches the run-time configured list
+ * of ignore patterns, specified by the array @a ignores.
+ */
+svn_boolean_t svn_wc_is_ignored (const char *path,
+ apr_array_header_t *ignores);
+
+
#ifdef __cplusplus
}
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4726)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -36,11 +36,9 @@
#include "props.h"
-/* Get the run-time configured list of ignore patterns, and store them
- in *PATTERNS. Allocate *PATTERNS and its contents in POOL. */
-static svn_error_t *
-get_default_ignores (apr_array_header_t **patterns,
- apr_pool_t *pool)
+svn_error_t *
+svn_wc_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool)
{
struct svn_config_t *cfg;
const char *val;
@@ -57,6 +55,22 @@
return SVN_NO_ERROR;
}
+svn_boolean_t
+svn_wc_is_ignored (const char *path,
+ apr_array_header_t *ignores)
+{
+ int i;
+
+ for (i = 0; ignores && (i < ignores->nelts); i++)
+ {
+ const char *pat = (((const char **) (ignores)->elts))[i];
+
+ if (APR_SUCCESS == apr_fnmatch (pat, path, FNM_PERIOD))
+ return TRUE;
+ }
+
+ return FALSE;
+}
/* Helper routine: add to *PATTERNS patterns from the value of
the SVN_PROP_IGNORE property set on DIRPATH. If there is no such
@@ -433,7 +447,6 @@
apr_ssize_t klen;
void *val;
const char *keystring;
- int i;
int ignore_me;
const char *printable_path;
svn_node_kind_t *path_kind;
@@ -450,22 +463,8 @@
if (! strcmp (keystring, SVN_WC_ADM_DIR_NAME))
continue;
- ignore_me = 0;
+ ignore_me = svn_wc_is_ignored (keystring, patterns);
- /* See if any of the ignore patterns we have matches our
- keystring. */
- for (i = 0; patterns && (i < patterns->nelts); i++)
- {
- const char *pat = (((const char **) (patterns)->elts))[i];
-
- /* Try to match current_entry_name to pat. */
- if (APR_SUCCESS == apr_fnmatch (pat, keystring, FNM_PERIOD))
- {
- ignore_me = 1;
- break;
- }
- }
-
/* If we aren't ignoring it, add a status structure for this
dirent. */
if (no_ignore || ! ignore_me)
@@ -554,7 +553,7 @@
SVN_ERR (svn_wc_entries_read (&entries, adm_access, FALSE, pool));
/* Read the default ignores from the config files. */
- SVN_ERR (get_default_ignores (&ignores, pool));
+ SVN_ERR (svn_wc_get_default_ignores (&ignores, pool));
/* Add the unversioned items to the status output. */
SVN_ERR (add_unversioned_items (path, adm_access, entries, statushash,
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 4726)
+++ subversion/libsvn_client/add.c (working copy)
@@ -48,6 +48,7 @@
apr_pool_t *subpool;
apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
svn_wc_adm_access_t *dir_access;
+ apr_array_header_t *ignores;
/* Add this directory to revision control. */
SVN_ERR (svn_wc_add (dirname, adm_access,
@@ -56,6 +57,8 @@
SVN_ERR (svn_wc_adm_retrieve (&dir_access, adm_access, dirname, pool));
+ SVN_ERR (svn_wc_get_default_ignores (&ignores, pool));
+
/* Create a subpool for iterative memory control. */
subpool = svn_pool_create (pool);
@@ -76,6 +79,9 @@
if (this_entry.name[0] == '.'
&& (this_entry.name[1] == '\0'
|| (this_entry.name[1] == '.' && this_entry.name[2] == '\0')))
+ continue;
+
+ if (svn_wc_is_ignored (this_entry.name, ignores))
continue;
/* Construct the full path of the entry. */
Index: subversion/tests/clients/cmdline/basic_tests.py
===================================================================
--- subversion/tests/clients/cmdline/basic_tests.py (revision 4726)
+++ subversion/tests/clients/cmdline/basic_tests.py (working copy)
@@ -1481,6 +1481,48 @@
os.path.join(wc_dir, 'A', 'D', 'G'))
if errput: return 1
+
+#----------------------------------------------------------------------
+def basic_add_ignores(sbox):
+ 'ignored files in the added directory should not be added'
+
+ # The bug was that
+ #
+ # $ svn add dir
+ #
+ # where dir contains some items that match the ignore list and some
+ # do not would add all items, ignored or not.
+ #
+ # This bug was fixed in revision XXX, by testing each item with the
+ # new svn_config_is_ignored function.
+
+ if sbox.build():
+ return 1
+
+ wc_dir = sbox.wc_dir
+
+ dir_path = os.path.join(wc_dir, 'dir')
+ foo_c_path = os.path.join(dir_path, 'foo.c')
+ foo_o_path = os.path.join(dir_path, 'foo.o')
+
+ os.mkdir(dir_path, 0755)
+ open(foo_c_path, 'w')
+ open(foo_o_path, 'w')
+
+ (output, errput) = svntest.main.run_svn (None, 'add', dir_path)
+
+ if not output:
+ return 1
+
+ for line in output:
+ # If we see foo.o in the add output, fail the test.
+ if re.match(r'^A\s+.*foo.o$', line):
+ return 1
+
+ # Else never matched the unwanted output, so the test passed.
+ return 0
+
+
#----------------------------------------------------------------------
########################################################################
@@ -1507,6 +1549,7 @@
Skip(basic_import_executable, (os.name != 'posix')),
nonexistent_repository,
basic_auth_cache,
+ basic_add_ignores,
### todo: more tests needed:
### test "svn rm http://some_url"
### not sure this file is the right place, though.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Karl Fogel kfogel@newton.ch.collab.net writes:
If you want to move it, that's fine. Actually, my alternative was to
put it in svn_client, since client implementations might want to know
if a file is in the ignore space or not. But heck, svn_wc works too.
I don't see a clear right answer here; we could also wait until
calling patterns make it clear, and then move it.
Discussion seems to have died out without a conclusion. Which
is it going to be?
--
Eric Gillespie * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie <ep...@pretzelnet.org>.
Karl Fogel <kf...@newton.ch.collab.net> writes:
> If you want to move it, that's fine. Actually, my alternative was to
> put it in svn_client, since client implementations might want to know
> if a file is in the ignore space or not. But heck, svn_wc works too.
> I don't see a clear right answer here; we could also wait until
> calling patterns make it clear, and then move it.
Discussion seems to have died out without a conclusion. Which
is it going to be?
--
Eric Gillespie <*> epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Branko Čibej brane@xbc.nu writes:
Please, no. svn_config reads configuration, yes, but it doesn't
interpret it. Putting this in svn_config breaks our interface
separation. The ability to ignore files is a feature of the working copy
(not even of the client!), so that get_default_ignores should go into
svn_wc.
That was my original argument to myself about why it shouldn't go into
svn_config. But then I thought: it's *not* interpreting it. The new
interface has one function to retrieve a specific config value as a
list, and another function to tell you if a specific pattern is in the
list. Both of these are simply more fine-grained versions of what we
already do in svn_config. The config interface already reads file
data into a structure, and then provides functions to get bits of that
data out of the structure.
How a caller uses the data is another matter, of course. It's not
svn_config that's actually ignoring the files, it's still svn_wc.
If you want to move it, that's fine. Actually, my alternative was to
put it in svn_client, since client implementations might want to know
if a file is in the ignore space or not. But heck, svn_wc works too.
I don't see a clear right answer here; we could also wait until
calling patterns make it clear, and then move it.
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Branko Čibej br...@xbc.nu.
Karl Fogel wrote:
Eric Gillespie epg@pretzelnet.org writes:
I think that would be fine.
Which? You said a lot, but i'm not sure if it boils down to
putting it in wc, client, or config.
I was answering your question Should it go there?, referring to
svn_config.h. So yes, config.
Please, no. svn_config reads configuration, yes, but it doesn't
interpret it. Putting this in svn_config breaks our interface
separation. The ability to ignore files is a feature of the working copy
(not even of the client!), so that get_default_ignores should go into
svn_wc.
--
Brane Čibej brane@xbc.nu http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
[PATCH and TEST] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Karl Fogel kfogel@newton.ch.collab.net writes:
Also, if you have time to add a regression test, that would be great.
Should be pretty short simple, for this.
Let me know when you guys are done battling out where this
functionality should live. I will then post an updated patch.
In the meantime, here is the patch again, this time with the log
message again, and now with a regression test. It's only my
second test--the other was a test for issue 1084 earlier
today--so both of these probably merit a more careful review.
Log message and patch:
A recursive svn add was scheduling items matching the user's ignore
list for addition. Export svn_wc's ignores functionality and use that
in svn_client to correct this.
* subversion/include/svn_config.h:
Add prototypes and documentation for svn_config_get_default_ignores
and svn_config_is_ignored.
* subversion/libsvn_wc/status.c:
(get_default_ignores): Moved to svn_config_get_default_ignores in
libsvn_subr/config.c.
(add_unversioned_items): Use svn_config_is_ignored.
(get_dir_status): Use svn_config_is_ignored.
* subversion/libsvn_subr/config.c:
(svn_config_get_default_ignores): New function, basically identical
to the old get_default_ignores in libsvn_wc/status.c.
(svn_config_is_ignored): New function, basically copied from the check
in add_unversioned_items.
* subversion/libsvn_client/add.c:
(add_dir_recursive): Use svn_config_is_ignored to avoid adding items
matching the user's ignore list.
* subversion/tests/clients/cmdline/basic_tests.py:
(basic_add_ignores): Regression test for this bug.
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 4559)
+++ subversion/include/svn_config.h (working copy)
@@ -207,6 +207,20 @@
svn_error_t *svn_config_ensure (apr_pool_t *pool);
+/** Get the run-time configured list of ignore patterns, and store
+ * them in @a patterns. Allocate @a patterns and its contents in @a
+ * pool.
+ */
+svn_error_t *svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool);
+
+/** Determine whether a @a path matches the run-time configured list
+ * of ignore patterns, specified by the array @a ignores.
+ */
+svn_boolean_t svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4559)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -23,7 +23,6 @@
#include apr_file_io.h
#include apr_hash.h
#include apr_time.h
-#include apr_fnmatch.h
#include svn_pools.h
#include svn_types.h
#include svn_string.h
@@ -36,28 +35,6 @@
#include props.h
-/* Get the run-time configured list of ignore patterns, and store them
- in *PATTERNS. Allocate *PATTERNS and its contents in POOL. */
-static svn_error_t *
-get_default_ignores (apr_array_header_t **patterns,
- apr_pool_t *pool)
-{
- struct svn_config_t *cfg;
- const char *val;
-
- /* Check the Subversion run-time configuration for global ignores.
- If no configuration value exists, we fall back to our defaults. */
- SVN_ERR (svn_config_read_config (cfg, pool));
- svn_config_get (cfg, val, miscellany, global-ignores,
- *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
- *patterns = apr_array_make (pool, 16, sizeof (const char *));
-
- /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
- svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
- return SVN_NO_ERROR;
-}
-
-
/* Helper routine: add to *PATTERNS patterns from the value of
the SVN_PROP_IGNORE property set on DIRPATH. If there is no such
property, or the property contains no patterns, do nothing.
@@ -433,7 +410,6 @@
apr_ssize_t klen;
void *val;
const char *keystring;
- int i;
int ignore_me;
const char *printable_path;
svn_node_kind_t *path_kind;
@@ -450,22 +426,8 @@
if (! strcmp (keystring, SVN_WC_ADM_DIR_NAME))
continue;
- ignore_me = 0;
+ ignore_me = svn_config_is_ignored (keystring, patterns);
- /* See if any of the ignore patterns we have matches our
- keystring. */
- for (i = 0; patterns (i patterns-nelts); i++)
- {
- const char *pat = (((const char **) (patterns)-elts))[i];
-
- /* Try to match current_entry_name to pat. */
- if (APR_SUCCESS == apr_fnmatch (pat, keystring, FNM_PERIOD))
- {
- ignore_me = 1;
- break;
- }
- }
-
/* If we aren't ignoring it, add a status structure for this
dirent. */
if (no_ignore || ! ignore_me)
@@ -557,7 +519,7 @@
SVN_ERR (svn_wc_entries_read (entries, adm_access, FALSE, pool));
/* Read the default ignores from the config files. */
- SVN_ERR (get_default_ignores (ignores, pool));
+ SVN_ERR (svn_config_get_default_ignores (ignores, pool));
/* Add the unversioned items to the status output. */
SVN_ERR (add_unversioned_items (path, adm_access, entries, statushash,
Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c (revision 4559)
+++ subversion/libsvn_subr/config.c (working copy)
@@ -22,6 +22,7 @@
#define APR_WANT_MEMFUNC
#include apr_want.h
+#include apr_fnmatch.h
#include apr_lib.h
#include apr_user.h
#include svn_error.h
@@ -533,4 +534,40 @@
gb.pool = pool;
svn_config_enumerate (cfg, master_section, search_groups, );
return gb.match;
+}
+
+svn_error_t *
+svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool)
+{
+ struct svn_config_t *cfg;
+ const char *val;
+
+ /* Check the Subversion run-time configuration for global ignores.
+ If no configuration value exists, we fall back to our defaults. */
+ SVN_ERR (svn_config_read_config (cfg, pool));
+ svn_config_get (cfg, val, miscellany, global-ignores,
+ *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
+ *patterns = apr_array_make (pool, 16, sizeof (const char *));
+
+ /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
+ svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
+ return SVN_NO_ERROR;
+}
+
+svn_boolean_t
+svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores)
+{
+ int i;
+
+ for (i = 0; ignores (i ignores-nelts); i++)
+ {
+ const char *pat = (((const char **) (ignores)-elts))[i];
+
+ if (APR_SUCCESS == apr_fnmatch (pat, path, FNM_PERIOD))
+ return TRUE;
+ }
+
+ return FALSE;
}
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 4559)
+++ subversion/libsvn_client/add.c (working copy)
@@ -25,6 +25,7 @@
#include string.h
#include svn_wc.h
#include svn_client.h
+#include svn_config.h
#include svn_string.h
#include svn_pools.h
#include svn_error.h
@@ -49,6 +50,7 @@
apr_pool_t *subpool;
apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
svn_wc_adm_access_t *dir_access;
+ apr_array_header_t *ignores;
/* Add this directory to revision control. */
SVN_ERR (svn_wc_add (dirname, adm_access,
@@ -57,6 +59,8 @@
SVN_ERR (svn_wc_adm_retrieve (dir_access, adm_access, dirname, pool));
+ SVN_ERR (svn_config_get_default_ignores (ignores, pool));
+
/* Create a subpool for iterative memory control. */
subpool = svn_pool_create (pool);
@@ -77,6 +81,9 @@
if (this_entry.name[0] == '.'
(this_entry.name[1] == '\0'
|| (this_entry.name[1] == '.' this_entry.name[2] == '\0')))
+ continue;
+
+ if (svn_config_is_ignored (this_entry.name, ignores))
continue;
/* Construct the full path of the entry. */
Index: subversion/tests/clients/cmdline/basic_tests.py
===================================================================
--- subversion/tests/clients/cmdline/basic_tests.py (revision 4559)
+++ subversion/tests/clients/cmdline/basic_tests.py (working copy)
@@ -1481,6 +1481,48 @@
os.path.join(wc_dir, 'A', 'D', 'G'))
if errput: return 1
+
+#----------------------------------------------------------------------
+def basic_add_ignores(sbox):
+ 'ignored files in the added directory should not be added'
+
+ # The bug was that
+ #
+ # $ svn add dir
+ #
+ # where dir contains some items that match the ignore list and some
+ # do not would add all items, ignored or not.
+ #
+ # This bug was fixed in revision XXX, by testing each item with the
+ # new svn_config_is_ignored function.
+
+ if sbox.build():
+ return 1
+
+ wc_dir = sbox.wc_dir
+
+ dir_path = os.path.join(wc_dir, 'dir')
+ foo_c_path = os.path.join(dir_path, 'foo.c')
+ foo_o_path = os.path.join(dir_path, 'foo.o')
+
+ os.mkdir(dir_path, 0755)
+ open(foo_c_path, 'w')
+ open(foo_o_path, 'w')
+
+ (output, errput) = svntest.main.run_svn (None, 'add', dir_path)
+
+ if not output:
+ return 1
+
+ for line in output:
+ # If we see foo.o in the add output, fail the test.
+ if re.match(r'^A\s+.*foo.o$', line):
+ return 1
+
+ # Else never matched the unwanted output, so the test passed.
+ return 0
+
+
#----------------------------------------------------------------------
########################################################################
@@ -1507,6 +1549,7 @@
Skip(basic_import_executable, (os.name != 'posix')),
nonexistent_repository,
basic_auth_cache,
+ basic_add_ignores,
### todo: more tests needed:
### test svn rm http://some_url
### not sure this file is the right place, though.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
cmpilato@collab.net writes:
Might I submit a suggestion on this patch? Rather than silently
skipping ignored things, can we use the svn_wc_notify_skip
notification type to inform people that stuff is being skipped?
No, the point of the ignore list is that items matching it should
be IGNORED. I don't ever want svn saying anything at all about
.o files. They're .o files for pete's sake!
--
Eric Gillespie * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by cm...@collab.net.
Eric Gillespie epg@pretzelnet.org writes:
Karl Fogel kfogel@newton.ch.collab.net writes:
...which is quite understandable, since apr_fnmatch.h is not included
by config.c :-).
DOH! That isn't the only problem with that patch... I put the
patch into the message i was composing before the build/check
finished and never replaced it with the correct patch, which is
included below.
Also, if you have time to add a regression test, that would be great.
Should be pretty short simple, for this.
Yeah, OK. I've never peeked into Subversion's test suite before.
I'll try to come up with something tomorrow night.
Might I submit a suggestion on this patch? Rather than silently
skipping ignored things, can we use the svn_wc_notify_skip
notification type to inform people that stuff is being skipped?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Eric Gillespie epg@pretzelnet.org writes:
DOH! That isn't the only problem with that patch... I put the
patch into the message i was composing before the build/check
finished and never replaced it with the correct patch, which is
included below.
:-). Been there.
Also, if you have time to add a regression test, that would be great.
Should be pretty short simple, for this.
Yeah, OK. I've never peeked into Subversion's test suite before.
I'll try to come up with something tomorrow night.
Okay, will wait for that.
This may seem like nit-picking, but it's a big help: please include
the full log message with every posting of a patch. Otherwise, the
reviewer has to hunt down old log message and guess whether it still
applies (while knowing that the new patch is at least slightly
different from the old one, or it wouldn't have been reposted...)
Keeping patches self-contained and travelable makes the whole system
a bit easier.
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Karl Fogel kfogel@newton.ch.collab.net writes:
...which is quite understandable, since apr_fnmatch.h is not included
by config.c :-).
DOH! That isn't the only problem with that patch... I put the
patch into the message i was composing before the build/check
finished and never replaced it with the correct patch, which is
included below.
Also, if you have time to add a regression test, that would be great.
Should be pretty short simple, for this.
Yeah, OK. I've never peeked into Subversion's test suite before.
I'll try to come up with something tomorrow night.
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 4549)
+++ subversion/include/svn_config.h (working copy)
@@ -207,6 +207,20 @@
svn_error_t *svn_config_ensure (apr_pool_t *pool);
+/** Get the run-time configured list of ignore patterns, and store
+ * them in @a patterns. Allocate @a patterns and its contents in @a
+ * pool.
+ */
+svn_error_t *svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool);
+
+/** Determine whether a @a path matches the run-time configured list
+ * of ignore patterns, specified by the array @a ignores.
+ */
+svn_boolean_t svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4549)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -23,7 +23,6 @@
#include apr_file_io.h
#include apr_hash.h
#include apr_time.h
-#include apr_fnmatch.h
#include svn_pools.h
#include svn_types.h
#include svn_string.h
@@ -36,28 +35,6 @@
#include props.h
-/* Get the run-time configured list of ignore patterns, and store them
- in *PATTERNS. Allocate *PATTERNS and its contents in POOL. */
-static svn_error_t *
-get_default_ignores (apr_array_header_t **patterns,
- apr_pool_t *pool)
-{
- struct svn_config_t *cfg;
- const char *val;
-
- /* Check the Subversion run-time configuration for global ignores.
- If no configuration value exists, we fall back to our defaults. */
- SVN_ERR (svn_config_read_config (cfg, pool));
- svn_config_get (cfg, val, miscellany, global-ignores,
- *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
- *patterns = apr_array_make (pool, 16, sizeof (const char *));
-
- /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
- svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
- return SVN_NO_ERROR;
-}
-
-
/* Helper routine: add to *PATTERNS patterns from the value of
the SVN_PROP_IGNORE property set on DIRPATH. If there is no such
property, or the property contains no patterns, do nothing.
@@ -433,7 +410,6 @@
apr_ssize_t klen;
void *val;
const char *keystring;
- int i;
int ignore_me;
const char *printable_path;
svn_node_kind_t *path_kind;
@@ -450,22 +426,8 @@
if (! strcmp (keystring, SVN_WC_ADM_DIR_NAME))
continue;
- ignore_me = 0;
+ ignore_me = svn_config_is_ignored (keystring, patterns);
- /* See if any of the ignore patterns we have matches our
- keystring. */
- for (i = 0; patterns (i patterns-nelts); i++)
- {
- const char *pat = (((const char **) (patterns)-elts))[i];
-
- /* Try to match current_entry_name to pat. */
- if (APR_SUCCESS == apr_fnmatch (pat, keystring, FNM_PERIOD))
- {
- ignore_me = 1;
- break;
- }
- }
-
/* If we aren't ignoring it, add a status structure for this
dirent. */
if (no_ignore || ! ignore_me)
@@ -557,7 +519,7 @@
SVN_ERR (svn_wc_entries_read (entries, adm_access, FALSE, pool));
/* Read the default ignores from the config files. */
- SVN_ERR (get_default_ignores (ignores, pool));
+ SVN_ERR (svn_config_get_default_ignores (ignores, pool));
/* Add the unversioned items to the status output. */
SVN_ERR (add_unversioned_items (path, adm_access, entries, statushash,
Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c (revision 4549)
+++ subversion/libsvn_subr/config.c (working copy)
@@ -22,6 +22,7 @@
#define APR_WANT_MEMFUNC
#include apr_want.h
+#include apr_fnmatch.h
#include apr_lib.h
#include apr_user.h
#include svn_error.h
@@ -533,4 +534,40 @@
gb.pool = pool;
svn_config_enumerate (cfg, master_section, search_groups, );
return gb.match;
+}
+
+svn_error_t *
+svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool)
+{
+ struct svn_config_t *cfg;
+ const char *val;
+
+ /* Check the Subversion run-time configuration for global ignores.
+ If no configuration value exists, we fall back to our defaults. */
+ SVN_ERR (svn_config_read_config (cfg, pool));
+ svn_config_get (cfg, val, miscellany, global-ignores,
+ *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
+ *patterns = apr_array_make (pool, 16, sizeof (const char *));
+
+ /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
+ svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
+ return SVN_NO_ERROR;
+}
+
+svn_boolean_t
+svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores)
+{
+ int i;
+
+ for (i = 0; ignores (i ignores-nelts); i++)
+ {
+ const char *pat = (((const char **) (ignores)-elts))[i];
+
+ if (APR_SUCCESS == apr_fnmatch (pat, path, FNM_PERIOD))
+ return TRUE;
+ }
+
+ return FALSE;
}
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 4549)
+++ subversion/libsvn_client/add.c (working copy)
@@ -25,6 +25,7 @@
#include string.h
#include svn_wc.h
#include svn_client.h
+#include svn_config.h
#include svn_string.h
#include svn_pools.h
#include svn_error.h
@@ -49,6 +50,7 @@
apr_pool_t *subpool;
apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
svn_wc_adm_access_t *dir_access;
+ apr_array_header_t *ignores;
/* Add this directory to revision control. */
SVN_ERR (svn_wc_add (dirname, adm_access,
@@ -57,6 +59,8 @@
SVN_ERR (svn_wc_adm_retrieve (dir_access, adm_access, dirname, pool));
+ SVN_ERR (svn_config_get_default_ignores (ignores, pool));
+
/* Create a subpool for iterative memory control. */
subpool = svn_pool_create (pool);
@@ -77,6 +81,9 @@
if (this_entry.name[0] == '.'
(this_entry.name[1] == '\0'
|| (this_entry.name[1] == '.' this_entry.name[2] == '\0')))
+ continue;
+
+ if (svn_config_is_ignored (this_entry.name, ignores))
continue;
/* Construct the full path of the entry. */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Eric Gillespie epg@pretzelnet.org writes:
OK, this is the one. After this one is perfected and committed,
i'll take a look at svn import as cmpilato requested.
Hmm, did you succed in building this, Eric? I get the error
subversion/libsvn_subr/config.c: In function `svn_config_is_ignored':
subversion/libsvn_subr/config.c:567: warning: \
implicit declaration of function `apr_fnmatch'
subversion/libsvn_subr/config.c:567: `FNM_PERIOD' undeclared \
(first use in this function)
subversion/libsvn_subr/config.c:567: (Each undeclared identifier \
is reported only once
subversion/libsvn_subr/config.c:567: for each function it appears in.)
make: *** [subversion/libsvn_subr/config.lo] Error 1
...which is quite understandable, since apr_fnmatch.h is not included
by config.c :-).
Also, if you have time to add a regression test, that would be great.
Should be pretty short simple, for this.
Thanks,
-Karl
A recursive svn add was scheduling items matching the user's ignore
list for addition. Export svn_wc's ignores functionality and use that
in svn_client to correct this.
* subversion/include/svn_config.h:
Add prototypes and documentation for svn_config_get_default_ignores
and svn_config_is_ignored.
* subversion/libsvn_wc/status.c:
(get_default_ignores): Moved to svn_config_get_default_ignores in
libsvn_subr/config.c.
(add_unversioned_items): Use svn_config_is_ignored.
(get_dir_status): Use svn_config_is_ignored.
* subversion/libsvn_subr/config.c:
(svn_config_get_default_ignores): New function, basically identical
to the old get_default_ignores in libsvn_wc/status.c.
(svn_config_is_ignored): New function, basically copied from the check
in add_unversioned_items.
* subversion/libsvn_client/add.c:
(add_dir_recursive): Use svn_config_is_ignored to avoid adding items
matching the user's ignore list.
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 4549)
+++ subversion/include/svn_config.h (working copy)
@@ -207,6 +207,20 @@
svn_error_t *svn_config_ensure (apr_pool_t *pool);
+/** Get the run-time configured list of ignore patterns, and store
+ * them in @a patterns. Allocate @a patterns and its contents in @a
+ * pool.
+ */
+svn_error_t *svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool);
+
+/** Determine whether a @a path matches the run-time configured list
+ * of ignore patterns, specified by the array @a ignores.
+ */
+svn_boolean_t svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4549)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -36,28 +36,6 @@
#include props.h
-/* Get the run-time configured list of ignore patterns, and store them
- in *PATTERNS. Allocate *PATTERNS and its contents in POOL. */
-static svn_error_t *
-get_default_ignores (apr_array_header_t **patterns,
- apr_pool_t *pool)
-{
- struct svn_config_t *cfg;
- const char *val;
-
- /* Check the Subversion run-time configuration for global ignores.
- If no configuration value exists, we fall back to our defaults. */
- SVN_ERR (svn_config_read_config (cfg, pool));
- svn_config_get (cfg, val, miscellany, global-ignores,
- *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
- *patterns = apr_array_make (pool, 16, sizeof (const char *));
-
- /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
- svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
- return SVN_NO_ERROR;
-}
-
-
/* Helper routine: add to *PATTERNS patterns from the value of
the SVN_PROP_IGNORE property set on DIRPATH. If there is no such
property, or the property contains no patterns, do nothing.
@@ -433,7 +411,6 @@
apr_ssize_t klen;
void *val;
const char *keystring;
- int i;
int ignore_me;
const char *printable_path;
svn_node_kind_t *path_kind;
@@ -450,22 +427,8 @@
if (! strcmp (keystring, SVN_WC_ADM_DIR_NAME))
continue;
- ignore_me = 0;
+ ignore_me = svn_config_is_ignored (keystring, patterns);
- /* See if any of the ignore patterns we have matches our
- keystring. */
- for (i = 0; patterns (i patterns-nelts); i++)
- {
- const char *pat = (((const char **) (patterns)-elts))[i];
-
- /* Try to match current_entry_name to pat. */
- if (APR_SUCCESS == apr_fnmatch (pat, keystring, FNM_PERIOD))
- {
- ignore_me = 1;
- break;
- }
- }
-
/* If we aren't ignoring it, add a status structure for this
dirent. */
if (no_ignore || ! ignore_me)
@@ -557,7 +520,7 @@
SVN_ERR (svn_wc_entries_read (entries, adm_access, FALSE, pool));
/* Read the default ignores from the config files. */
- SVN_ERR (get_default_ignores (ignores, pool));
+ SVN_ERR (svn_config_get_default_ignores (ignores, pool));
/* Add the unversioned items to the status output. */
SVN_ERR (add_unversioned_items (path, adm_access, entries, statushash,
Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c (revision 4549)
+++ subversion/libsvn_subr/config.c (working copy)
@@ -534,3 +534,39 @@
svn_config_enumerate (cfg, master_section, search_groups, );
return gb.match;
}
+
+svn_error_t *
+svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool)
+{
+ struct svn_config_t *cfg;
+ const char *val;
+
+ /* Check the Subversion run-time configuration for global ignores.
+ If no configuration value exists, we fall back to our defaults. */
+ SVN_ERR (svn_config_read_config (cfg, pool));
+ svn_config_get (cfg, val, miscellany, global-ignores,
+ *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
+ *patterns = apr_array_make (pool, 16, sizeof (const char *));
+
+ /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
+ svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
+ return SVN_NO_ERROR;
+}
+
+svn_boolean_t
+svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores)
+{
+ int i;
+
+ for (i = 0; ignores (i ignores-nelts); i++)
+ {
+ const char *pat = (((const char **) (ignores)-elts))[i];
+
+ if (APR_SUCCESS == apr_fnmatch (pat, path, FNM_PERIOD))
+ return TRUE;
+ }
+
+ return FALSE;
+}
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 4549)
+++ subversion/libsvn_client/add.c (working copy)
@@ -49,6 +49,7 @@
apr_pool_t *subpool;
apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
svn_wc_adm_access_t *dir_access;
+ apr_array_header_t *ignores;
/* Add this directory to revision control. */
SVN_ERR (svn_wc_add (dirname, adm_access,
@@ -57,6 +58,8 @@
SVN_ERR (svn_wc_adm_retrieve (dir_access, adm_access, dirname, pool));
+ SVN_ERR (svn_wc_get_default_ignores (ignores, pool));
+
/* Create a subpool for iterative memory control. */
subpool = svn_pool_create (pool);
@@ -77,6 +80,9 @@
if (this_entry.name[0] == '.'
(this_entry.name[1] == '\0'
|| (this_entry.name[1] == '.' this_entry.name[2] == '\0')))
+ continue;
+
+ if (svn_wc_is_ignored (this_entry.name, ignores))
continue;
/* Construct the full path of the entry. */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
[PATCH] Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Karl Fogel kfogel@newton.ch.collab.net writes:
I was answering your question Should it go there?, referring to
svn_config.h. So yes, config.
OK, this is the one. After this one is perfected and committed,
i'll take a look at svn import as cmpilato requested.
A recursive svn add was scheduling items matching the user's ignore
list for addition. Export svn_wc's ignores functionality and use that
in svn_client to correct this.
* subversion/include/svn_config.h:
Add prototypes and documentation for svn_config_get_default_ignores
and svn_config_is_ignored.
* subversion/libsvn_wc/status.c:
(get_default_ignores): Moved to svn_config_get_default_ignores in
libsvn_subr/config.c.
(add_unversioned_items): Use svn_config_is_ignored.
(get_dir_status): Use svn_config_is_ignored.
* subversion/libsvn_subr/config.c:
(svn_config_get_default_ignores): New function, basically identical
to the old get_default_ignores in libsvn_wc/status.c.
(svn_config_is_ignored): New function, basically copied from the check
in add_unversioned_items.
* subversion/libsvn_client/add.c:
(add_dir_recursive): Use svn_config_is_ignored to avoid adding items
matching the user's ignore list.
Index: subversion/include/svn_config.h
===================================================================
--- subversion/include/svn_config.h (revision 4549)
+++ subversion/include/svn_config.h (working copy)
@@ -207,6 +207,20 @@
svn_error_t *svn_config_ensure (apr_pool_t *pool);
+/** Get the run-time configured list of ignore patterns, and store
+ * them in @a patterns. Allocate @a patterns and its contents in @a
+ * pool.
+ */
+svn_error_t *svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool);
+
+/** Determine whether a @a path matches the run-time configured list
+ * of ignore patterns, specified by the array @a ignores.
+ */
+svn_boolean_t svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores);
+
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4549)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -36,28 +36,6 @@
#include props.h
-/* Get the run-time configured list of ignore patterns, and store them
- in *PATTERNS. Allocate *PATTERNS and its contents in POOL. */
-static svn_error_t *
-get_default_ignores (apr_array_header_t **patterns,
- apr_pool_t *pool)
-{
- struct svn_config_t *cfg;
- const char *val;
-
- /* Check the Subversion run-time configuration for global ignores.
- If no configuration value exists, we fall back to our defaults. */
- SVN_ERR (svn_config_read_config (cfg, pool));
- svn_config_get (cfg, val, miscellany, global-ignores,
- *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
- *patterns = apr_array_make (pool, 16, sizeof (const char *));
-
- /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
- svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
- return SVN_NO_ERROR;
-}
-
-
/* Helper routine: add to *PATTERNS patterns from the value of
the SVN_PROP_IGNORE property set on DIRPATH. If there is no such
property, or the property contains no patterns, do nothing.
@@ -433,7 +411,6 @@
apr_ssize_t klen;
void *val;
const char *keystring;
- int i;
int ignore_me;
const char *printable_path;
svn_node_kind_t *path_kind;
@@ -450,22 +427,8 @@
if (! strcmp (keystring, SVN_WC_ADM_DIR_NAME))
continue;
- ignore_me = 0;
+ ignore_me = svn_config_is_ignored (keystring, patterns);
- /* See if any of the ignore patterns we have matches our
- keystring. */
- for (i = 0; patterns (i patterns-nelts); i++)
- {
- const char *pat = (((const char **) (patterns)-elts))[i];
-
- /* Try to match current_entry_name to pat. */
- if (APR_SUCCESS == apr_fnmatch (pat, keystring, FNM_PERIOD))
- {
- ignore_me = 1;
- break;
- }
- }
-
/* If we aren't ignoring it, add a status structure for this
dirent. */
if (no_ignore || ! ignore_me)
@@ -557,7 +520,7 @@
SVN_ERR (svn_wc_entries_read (entries, adm_access, FALSE, pool));
/* Read the default ignores from the config files. */
- SVN_ERR (get_default_ignores (ignores, pool));
+ SVN_ERR (svn_config_get_default_ignores (ignores, pool));
/* Add the unversioned items to the status output. */
SVN_ERR (add_unversioned_items (path, adm_access, entries, statushash,
Index: subversion/libsvn_subr/config.c
===================================================================
--- subversion/libsvn_subr/config.c (revision 4549)
+++ subversion/libsvn_subr/config.c (working copy)
@@ -534,3 +534,39 @@
svn_config_enumerate (cfg, master_section, search_groups, );
return gb.match;
}
+
+svn_error_t *
+svn_config_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool)
+{
+ struct svn_config_t *cfg;
+ const char *val;
+
+ /* Check the Subversion run-time configuration for global ignores.
+ If no configuration value exists, we fall back to our defaults. */
+ SVN_ERR (svn_config_read_config (cfg, pool));
+ svn_config_get (cfg, val, miscellany, global-ignores,
+ *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#*);
+ *patterns = apr_array_make (pool, 16, sizeof (const char *));
+
+ /* Split the patterns on whitespace, and stuff them into *PATTERNS. */
+ svn_cstring_split_append (*patterns, val, \n\r\t\v , FALSE, pool);
+ return SVN_NO_ERROR;
+}
+
+svn_boolean_t
+svn_config_is_ignored (const char *path,
+ apr_array_header_t *ignores)
+{
+ int i;
+
+ for (i = 0; ignores (i ignores-nelts); i++)
+ {
+ const char *pat = (((const char **) (ignores)-elts))[i];
+
+ if (APR_SUCCESS == apr_fnmatch (pat, path, FNM_PERIOD))
+ return TRUE;
+ }
+
+ return FALSE;
+}
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 4549)
+++ subversion/libsvn_client/add.c (working copy)
@@ -49,6 +49,7 @@
apr_pool_t *subpool;
apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
svn_wc_adm_access_t *dir_access;
+ apr_array_header_t *ignores;
/* Add this directory to revision control. */
SVN_ERR (svn_wc_add (dirname, adm_access,
@@ -57,6 +58,8 @@
SVN_ERR (svn_wc_adm_retrieve (dir_access, adm_access, dirname, pool));
+ SVN_ERR (svn_wc_get_default_ignores (ignores, pool));
+
/* Create a subpool for iterative memory control. */
subpool = svn_pool_create (pool);
@@ -77,6 +80,9 @@
if (this_entry.name[0] == '.'
(this_entry.name[1] == '\0'
|| (this_entry.name[1] == '.' this_entry.name[2] == '\0')))
+ continue;
+
+ if (svn_wc_is_ignored (this_entry.name, ignores))
continue;
/* Construct the full path of the entry. */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Eric Gillespie epg@pretzelnet.org writes:
I think that would be fine.
Which? You said a lot, but i'm not sure if it boils down to
putting it in wc, client, or config.
I was answering your question Should it go there?, referring to
svn_config.h. So yes, config.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
I looked at it anyway, though, so the probability is now 100% :-).
Just pointing it out for next time.
OK.
I think that would be fine.
Which? You said a lot, but i'm not sure if it boils down to
putting it in wc, client, or config.
--
Eric Gillespie * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Eric Gillespie epg@pretzelnet.org writes:
OK, here's the preliminary patch. I haven't documented the
function yet, but i wanted to ask some questions first. Where
should the new functions go?
Aw heck, what does not knowing where it lives have to do with
documenting the interfaces? :-) No log message no docs just raises
the reviewability bar, i.e., lowers the probability that someone will
look at it.
I looked at it anyway, though, so the probability is now 100% :-).
Just pointing it out for next time.
They are currently in svn_wc
because that is where the original get_default_ignores function
was. But notice that it doesn't use any other svn_wc
functionality; as a matter of fact it only uses svn_config.
Should it go there?
I think that would be fine.
We could put it in svn_client.h, the idea being that client
implementations might want to ask about this list, and they should get
it from there instead of all the down in svn_wc.h. But then I suppose
we'd have to pass the list down into all the wc code paths that might
need it, and wc would still need to call the is_ignored() function on
the list, which would be a semi-weird layering interaction if that
function were back up in svn_client.
(I just composed and erased a whole mail saying why I didn't think it
belonged in libsvn_wc, then decided that was stupid and you were
right. Not that wc would necessarily be wrong, of course.)
Other than that, how does it look?
Looks good!
-K
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Greg Stein gstein@lyra.org writes:
Go for it. Jon might find the time to file an issue, but dig into SVN and
make a change to the WC code? Nah... :-)
OK, here's the preliminary patch. I haven't documented the
function yet, but i wanted to ask some questions first. Where
should the new functions go? They are currently in svn_wc
because that is where the original get_default_ignores function
was. But notice that it doesn't use any other svn_wc
functionality; as a matter of fact it only uses svn_config.
Should it go there?
Other than that, how does it look?
Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h (revision 4549)
+++ subversion/include/svn_wc.h (working copy)
@@ -1985,6 +1985,11 @@
const char **tempfile,
apr_pool_t *pool);
+svn_error_t *svn_wc_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool);
+
+svn_boolean_t svn_wc_is_ignored (const char *path,
+ apr_array_header_t *ignores);
#ifdef __cplusplus
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 4549)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -38,9 +38,9 @@
/* Get the run-time configured list of ignore patterns, and store them
in *PATTERNS. Allocate *PATTERNS and its contents in POOL. */
-static svn_error_t *
-get_default_ignores (apr_array_header_t **patterns,
- apr_pool_t *pool)
+svn_error_t *
+svn_wc_get_default_ignores (apr_array_header_t **patterns,
+ apr_pool_t *pool)
{
struct svn_config_t *cfg;
const char *val;
@@ -57,6 +57,22 @@
return SVN_NO_ERROR;
}
+svn_boolean_t
+svn_wc_is_ignored (const char *path,
+ apr_array_header_t *ignores)
+{
+ int i;
+
+ for (i = 0; ignores (i ignores-nelts); i++)
+ {
+ const char *pat = (((const char **) (ignores)-elts))[i];
+
+ if (APR_SUCCESS == apr_fnmatch (pat, path, FNM_PERIOD))
+ return TRUE;
+ }
+
+ return FALSE;
+}
/* Helper routine: add to *PATTERNS patterns from the value of
the SVN_PROP_IGNORE property set on DIRPATH. If there is no such
@@ -433,7 +449,6 @@
apr_ssize_t klen;
void *val;
const char *keystring;
- int i;
int ignore_me;
const char *printable_path;
svn_node_kind_t *path_kind;
@@ -450,22 +465,8 @@
if (! strcmp (keystring, SVN_WC_ADM_DIR_NAME))
continue;
- ignore_me = 0;
+ ignore_me = svn_wc_is_ignored (keystring, patterns);
- /* See if any of the ignore patterns we have matches our
- keystring. */
- for (i = 0; patterns (i patterns-nelts); i++)
- {
- const char *pat = (((const char **) (patterns)-elts))[i];
-
- /* Try to match current_entry_name to pat. */
- if (APR_SUCCESS == apr_fnmatch (pat, keystring, FNM_PERIOD))
- {
- ignore_me = 1;
- break;
- }
- }
-
/* If we aren't ignoring it, add a status structure for this
dirent. */
if (no_ignore || ! ignore_me)
@@ -557,7 +558,7 @@
SVN_ERR (svn_wc_entries_read (entries, adm_access, FALSE, pool));
/* Read the default ignores from the config files. */
- SVN_ERR (get_default_ignores (ignores, pool));
+ SVN_ERR (svn_wc_get_default_ignores (ignores, pool));
/* Add the unversioned items to the status output. */
SVN_ERR (add_unversioned_items (path, adm_access, entries, statushash,
Index: subversion/libsvn_client/add.c
===================================================================
--- subversion/libsvn_client/add.c (revision 4549)
+++ subversion/libsvn_client/add.c (working copy)
@@ -49,6 +49,7 @@
apr_pool_t *subpool;
apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
svn_wc_adm_access_t *dir_access;
+ apr_array_header_t *ignores;
/* Add this directory to revision control. */
SVN_ERR (svn_wc_add (dirname, adm_access,
@@ -57,6 +58,8 @@
SVN_ERR (svn_wc_adm_retrieve (dir_access, adm_access, dirname, pool));
+ SVN_ERR (svn_wc_get_default_ignores (ignores, pool));
+
/* Create a subpool for iterative memory control. */
subpool = svn_pool_create (pool);
@@ -77,6 +80,9 @@
if (this_entry.name[0] == '.'
(this_entry.name[1] == '\0'
|| (this_entry.name[1] == '.' this_entry.name[2] == '\0')))
+ continue;
+
+ if (svn_wc_is_ignored (this_entry.name, ignores))
continue;
/* Construct the full path of the entry. */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Greg Stein gs...@lyra.org.
On Wed, Jan 22, 2003 at 09:35:13PM -0500, Eric Gillespie wrote:
...
Yes, it sounds good to me. Let's make it public. Still planning to
write the patch?
Sure, unless Jon Trowbridge is planning to beat me to it. I'll
go ahead and create the svn_wc_get_ignores and svn_wc_is_ignored
functions (as suggested by Philip Martin).
Go for it. Jon might find the time to file an issue, but dig into SVN and
make a change to the WC code? Nah... :-)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Karl Fogel kfogel@newton.ch.collab.net writes:
Jon Trowbridge just noticed this too; I think he was going to (maybe
has?) file an issue. Those ignores should be honored, yes.
OK, i didn't see anything on the list about it.
Yes, it sounds good to me. Let's make it public. Still planning to
write the patch?
Sure, unless Jon Trowbridge is planning to beat me to it. I'll
go ahead and create the svn_wc_get_ignores and svn_wc_is_ignored
functions (as suggested by Philip Martin).
--
Eric Gillespie * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Karl Fogel kf...@newton.ch.collab.net.
Eric Gillespie epg@pretzelnet.org writes:
I have many of those files in global-ignores:
global-ignores = *.o *.lo *.la *.al .libs .so* .a #*# .*.rej *.rej .*~ *~ .#*
svn add should not add those files.
Jon Trowbridge just noticed this too; I think he was going to (maybe
has?) file an issue. Those ignores should be honored, yes.
Well, i was going to have a patch with this message, but it looks
like the ignore functionality is completely hidden in libsvn_wc.
It looks like it was expected that only svn status would need
this functionality. At least some of it should be exposed.
I was going to add a test to see if the item is to be ignored in
libsvn_client/add.c:add_dir_recursive right after the check for
'.svn', '.', and '..'. But to do that i need a function like
svn_wc_is_ignored.
Of course, another way to do it would be to have svn_wc_add call
get_default_ignores and check for this itself. But that seems
the wrong place to do it, to me. Furthermore, i still think
libsvn_wc should expose the ignore functionality. Even if it
turns out the svn program never does anything with it, other
clients may find it useful.
How does that sound?
Yes, it sounds good to me. Let's make it public. Still planning to
write the patch?
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Julian Foad ju...@btopenworld.com.
Eric Gillespie wrote:
Philip Martin philip@codematters.co.uk writes:
On second thoughts, it's not that simple. I agree that the extra
recursive targets should obey the global-ignores, but what about an
explict target? Should 'svn add foo.o' add the file despite the
global-ignores? I think it should.
Maybe, if the user has explicitly specified one file name. But what
about a wildcard like * that expands to lots of file names with some
of them matching global-ignores, or a list of file name arguments that
has been generated by find or the like? In particular, if I have ...
bar/foo.c
bar/foo.h
bar/foo.o
... I think I would want svn add bar/ to do the same as svn add
bar/*. In either case I might want it to tell me that it was ignoring
bar/foo.o.
Does 'svn add' now need a --no-ignore flag?
No, the change i am planning won't affect svn add foo.o. I'm
only changing add_recursive, which svn_client_add only calls if
path is a directory. And i think it is only this implicit,
recursive add that should honor ignores.
I am uncomfortable with the behaviour differing between implicit and
explicit lists of files to add.
So, for consistency, I feel the ignore list should apply to explicit
as well as implicit file names. Yes, it needs a --no-ignore flag like
the other commands that obey global-ignores (svn status and, maybe
soon, svn import).
cmpilato's suggestion to notify the user of skipped (ignored) files is
pretty much necessary. The notifications could be overridden with
--quiet. (Oh ... Eric disagrees.)
I have just played with svn status; it ignores files in implicitly
expanded directories but does not ignore explicit file name arguments.
Therefore I see an argument for making svn add consistent with the
current behaviour of svn status, but I'm not sure it's the right thing
to do.
- Julian
[I'm new here; please forgive me my trespasses.]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by cm...@collab.net.
Eric Gillespie epg@pretzelnet.org writes:
Philip Martin philip@codematters.co.uk writes:
On second thoughts, it's not that simple. I agree that the extra
recursive targets should obey the global-ignores, but what about an
explict target? Should 'svn add foo.o' add the file despite the
global-ignores? I think it should. Does 'svn add' now need a
--no-ignore flag?
No, the change i am planning won't affect svn add foo.o. I'm
only changing add_recursive, which svn_client_add only calls if
path is a directory. And i think it is only this implicit,
recursive add that should honor ignores.
Please fix 'svn import', too, while you're at it. :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Philip Martin philip@codematters.co.uk writes:
On second thoughts, it's not that simple. I agree that the extra
recursive targets should obey the global-ignores, but what about an
explict target? Should 'svn add foo.o' add the file despite the
global-ignores? I think it should. Does 'svn add' now need a
--no-ignore flag?
No, the change i am planning won't affect svn add foo.o. I'm
only changing add_recursive, which svn_client_add only calls if
path is a directory. And i think it is only this implicit,
recursive add that should honor ignores.
--
Eric Gillespie * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Philip Martin ph...@codematters.co.uk.
Philip Martin philip@codematters.co.uk writes:
Eric Gillespie epg@pretzelnet.org writes:
I have many of those files in global-ignores:
global-ignores = *.o *.lo *.la *.al .libs .so* .a #*# .*.rej *.rej .*~ *~ .#*
svn add should not add those files.
Agreed.
On second thoughts, it's not that simple. I agree that the extra
recursive targets should obey the global-ignores, but what about an
explict target? Should 'svn add foo.o' add the file despite the
global-ignores? I think it should. Does 'svn add' now need a
--no-ignore flag?
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Eric Gillespie ep...@pretzelnet.org.
Philip Martin philip@codematters.co.uk writes:
would be better. Or perhaps
svn_error_t *
svn_wc_get_ignores(apr_array_header_t *ignores,
apr_pool_t *pool);
svn_boolean_t
svn_wc_is_ignored(const char *path,
apr_array_header_t *ignores,
apr_pool_t *pool);
This is what i'll do.
--
Eric Gillespie * epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn add horkage (and exposing libsvn_wc's ignore functionality)
Posted by Philip Martin ph...@codematters.co.uk.
Eric Gillespie epg@pretzelnet.org writes:
I have many of those files in global-ignores:
global-ignores = *.o *.lo *.la *.al .libs .so* .a #*# .*.rej *.rej .*~ *~ .#*
svn add should not add those files.
Agreed.
Well, i was going to have a patch with this message, but it looks
like the ignore functionality is completely hidden in libsvn_wc.
It looks like it was expected that only svn status would need
this functionality. At least some of it should be exposed.
svn_client_delete already uses it, but it cheats, it gets it via
svn_wc_status.
I was going to add a test to see if the item is to be ignored in
libsvn_client/add.c:add_dir_recursive right after the check for
'.svn', '.', and '..'. But to do that i need a function like
svn_wc_is_ignored.
What sort of interface were you thinking of? The obvious
svn_error_t *
svn_wc_is_ignored(const char *path,
svn_boolean_t *ignored,
apr_pool_t *pool);
will involve parsing the config file for each individual path. That's
not a huge problem, but it is unfortunate. Possibly something like
svn_error_t *
svn_wc_is_ignored(apr_array_header_t *paths,
apr_array_header_t **ignored,
apr_pool_t *pool);
would be better. Or perhaps
svn_error_t *
svn_wc_get_ignores(apr_array_header_t *ignores,
apr_pool_t *pool);
svn_boolean_t
svn_wc_is_ignored(const char *path,
apr_array_header_t *ignores,
apr_pool_t *pool);
This is yet another problem that could be solved by some sort of
svn_context_t context parameter passed to all client/wc functions.
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org