Support '#' and ';' comments in exclude files. It would actually not
authorDavid Dykstra <dwd@samba.org>
Tue, 9 Feb 1999 22:31:52 +0000 (22:31 +0000)
committerDavid Dykstra <dwd@samba.org>
Tue, 9 Feb 1999 22:31:52 +0000 (22:31 +0000)
probably cause any harm if they were treated as normal exclude or include
patterns because they just wouldn't match anything, but it's better to
explicitly ignore them.  Suggested by David Holland <uholld1@lexis-nexis.com>

exclude.c
rsync.yo

index 35fa307..15dc310 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -234,7 +234,12 @@ struct exclude_struct **make_exclude_list(char *fname,
                int l = strlen(line);
                if (l && line[l-1] == '\n') l--;
                line[l] = 0;
-               if (line[0]) add_exclude_list(line,&list,include);
+               if (line[0] && (line[0] != ';') && (line[0] != '#')) {
+                       /* Skip lines starting with semicolon or pound.
+                          It probably wouldn't cause any harm to not skip
+                            them but there's no need to save them. */
+                       add_exclude_list(line,&list,include);
+               }
        }
        fclose(f);
        return list;
index db4c2b2..90599d7 100644 (file)
--- a/rsync.yo
+++ b/rsync.yo
@@ -465,7 +465,8 @@ this option.
 
 dit(bf(--exclude-from FILE)) This option is similar to the --exclude
 option, but instead it adds all filenames listed in the file FILE to
-the exclude list.
+the exclude list.  Blank lines in FILE and lines starting with ';' or '#'
+are ignored.
 
 dit(bf(--include pattern)) This option tells rsync to not exclude the
 specified pattern of filenames. This is useful as it allows you to