+ /* --delete-excluded turns an un-modified include/exclude into a
+ * sender-side rule. We also affect per-dir merge files that take
+ * no prefixes as a simple optimization. */
+ if (delete_excluded
+ && !(rule->rflags & FILTRULES_SIDES)
+ && (!(rule->rflags & FILTRULE_PERDIR_MERGE)
+ || rule->rflags & FILTRULE_NO_PREFIXES))
+ rule->rflags |= FILTRULE_SENDER_SIDE;
+
+ *pat_ptr = (const char *)s;
+ *pat_len_ptr = len;
+ *rulestr_ptr = *pat_ptr + len;
+ return rule;
+}
+
+static char default_cvsignore[] =
+ /* These default ignored items come from the CVS manual. */
+ "RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS"
+ " .make.state .nse_depinfo *~ #* .#* ,* _$* *$"
+ " *.old *.bak *.BAK *.orig *.rej .del-*"
+ " *.a *.olb *.o *.obj *.so *.exe"
+ " *.Z *.elc *.ln core"
+ /* The rest we added to suit ourself. */
+ " .svn/ .git/ .bzr/";
+
+static void get_cvs_excludes(uint32 rflags)
+{
+ static int initialized = 0;
+ char *p, fname[MAXPATHLEN];
+
+ if (initialized)
+ return;
+ initialized = 1;
+
+ parse_filter_str(&cvs_filter_list, default_cvsignore,
+ rule_template(rflags | (protocol_version >= 30 ? FILTRULE_PERISHABLE : 0)),
+ 0);
+
+ p = module_id >= 0 && lp_use_chroot(module_id) ? "/" : getenv("HOME");
+ if (p && pathjoin(fname, MAXPATHLEN, p, ".cvsignore") < MAXPATHLEN)
+ parse_filter_file(&cvs_filter_list, fname, rule_template(rflags), 0);
+
+ parse_filter_str(&cvs_filter_list, getenv("CVSIGNORE"), rule_template(rflags), 0);