- if (ent->match_flags & MATCHFLG_CVS_IGNORE
- && !(ent->match_flags & MATCHFLG_MERGE_FILE)) {
- if (am_sender || protocol_version < 29) {
- send_rules(f_out, &cvs_filter_list);
+ /* Note we need to check delete_excluded here in addition to
+ * the code in parse_rule_tok() because some rules may have
+ * been added before we found the --delete-excluded option.
+ * We must also elide any CVS merge-file rules to avoid a
+ * backward compatibility problem, and we elide any no-prefix
+ * merge files as an optimization (since they can only have
+ * include/exclude rules). */
+ if (ent->rflags & FILTRULE_SENDER_SIDE)
+ elide = am_sender ? 1 : -1;
+ if (ent->rflags & FILTRULE_RECEIVER_SIDE)
+ elide = elide ? 0 : am_sender ? -1 : 1;
+ else if (delete_excluded && !elide
+ && (!(ent->rflags & FILTRULE_PERDIR_MERGE)
+ || ent->rflags & FILTRULE_NO_PREFIXES))
+ elide = am_sender ? 1 : -1;
+ if (elide < 0) {
+ if (prev)
+ prev->next = ent->next;
+ else
+ flp->head = ent->next;
+ } else
+ prev = ent;
+ if (elide > 0)
+ continue;
+ if (ent->rflags & FILTRULE_CVS_IGNORE
+ && !(ent->rflags & FILTRULE_MERGE_FILE)) {
+ int f = am_sender || protocol_version < 29 ? f_out : -2;
+ send_rules(f, &cvs_filter_list);
+ if (f == f_out)