[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: revision 55 - trunk/subversion/include trunk/subversion/libsvn_wc trunk/subversion/libsvn_subr

From: Joe Orton <joe_at_manyfish.co.uk>
Date: 2001-09-06 00:41:12 CEST

On Wed, Sep 05, 2001 at 05:19:23PM -0500, Ben Sussman wrote:
> Author: sussman
> Date: 2001-09-05 22:19 GMT
> New Revision: 55
...
> Implement .svnignore files. :-)

Hoorah :) Anyone object to a set of hard-coded defaults too? I guess
this stuff should all be a global configure option eventually.

Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/SVN/text-base/adm_crawler.c Wed Sep 5 23:20:11 2001
+++ subversion/libsvn_wc/adm_crawler.c Wed Sep 5 23:36:23 2001
@@ -36,6 +36,23 @@
 
 #include <assert.h>
 
+static void add_default_ignores (apr_array_header_t *patterns)
+{
+ static const char *ignores[] =
+ {
+ "*.o", "*.lo", "*.rej", "*~", ".#*", "core",
+ /* what else? */
+ NULL
+ };
+ int i;
+
+ for (i = 0; ignores[i] != NULL; i++)
+ {
+ const char **ent = apr_array_push(patterns);
+ *ent = ignores[i];
+ }
+
+}
 
 /* Helper routine: try to read the contents of DIRPATH/.svnignore. If
    no such file exists, then set *PATTERNS to NULL. Otherwise, set
@@ -43,7 +60,7 @@
    an array of (const char *) objects. */
 static svn_error_t *
 load_ignore_file (const char *dirpath,
- apr_array_header_t **patterns,
+ apr_array_header_t *patterns,
                   apr_pool_t *pool)
 {
   apr_file_t *fp;
@@ -54,15 +71,12 @@
   /* Try to load the .svnignore file. */
   svn_stringbuf_t *path = svn_stringbuf_create (dirpath, pool);
   svn_path_add_component_nts (path, SVN_WC_SVNIGNORE, svn_path_local_style);
- status = apr_file_open (&fp, path->data, APR_READ, APR_OS_DEFAULT, pool);
- if (status)
+ if (apr_file_open (&fp, path->data, APR_READ, APR_OS_DEFAULT, pool))
     {
- *patterns = NULL;
       return SVN_NO_ERROR;
     }
 
   /* Now that it's open, read one line at a time into the array. */
- *patterns = apr_array_make (pool, 1, sizeof(const char *));
   while (1)
     {
       status = svn_io_read_length_line (fp, buf, &sz);
@@ -72,7 +86,7 @@
         return svn_error_createf(status, 0, NULL, pool,
                                  "error reading %s", path->data);
 
- (*((const char **) apr_array_push (*patterns))) =
+ (*((const char **) apr_array_push (patterns))) =
         apr_pstrndup (pool, buf, sz);
 
       sz = 100;
@@ -1466,7 +1480,9 @@
   SVN_ERR (svn_io_get_dirents (&dirents, full_path, subpool));
 
   /* Try to load any '.svnignore' file that may be present. */
- SVN_ERR (load_ignore_file (full_path->data, &patterns, subpool));
+ patterns = apr_array_make (pool, 1, sizeof(const char *));
+ SVN_ERR (load_ignore_file (full_path->data, patterns, subpool));
+ add_default_ignores (patterns);
 
   /* Phase 1: Print out every unrecognized (unversioned) object. */
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:40 2006

This is an archived mail posted to the Subversion Dev mailing list.