Fixed some patch fuzz.
[rsync/rsync-patches.git] / min-size.diff
CommitLineData
489b0a72 1--- orig/generator.c 2005-08-17 06:45:07
11f96ec2 2+++ generator.c 2005-04-28 16:19:24
994f69cd 3@@ -59,6 +59,7 @@ extern int make_backups;
11f96ec2
WD
4 extern int csum_length;
5 extern int ignore_times;
6 extern int size_only;
7+extern OFF_T min_size;
8 extern OFF_T max_size;
11f96ec2 9 extern int io_error;
5398d042 10 extern int allowed_lull;
489b0a72 11@@ -864,6 +865,15 @@ static void recv_generator(char *fname,
11f96ec2
WD
12 return;
13 }
14
15+ if (min_size && file->length < min_size) {
16+ if (verbose > 1) {
17+ if (the_file_list->count == 1)
18+ fname = f_name(file);
19+ rprintf(FINFO, "%s is under min-size\n",
20+ safe_fname(fname));
21+ }
22+ return;
23+ }
24 if (max_size && file->length > max_size) {
25 if (verbose > 1) {
26 if (the_file_list->count == 1)
489b0a72 27@@ -1269,7 +1279,7 @@ void generate_files(int f_out, struct fi
11f96ec2
WD
28
29 phase++;
30 csum_length = SUM_LENGTH;
31- only_existing = max_size = opt_ignore_existing = 0;
32+ only_existing = min_size = max_size = opt_ignore_existing = 0;
33 update_only = always_checksum = size_only = 0;
34 ignore_times = 1;
994f69cd 35 if (append_mode) /* resend w/o append mode */
489b0a72
WD
36--- orig/options.c 2005-08-27 21:11:26
37+++ options.c 2005-08-27 21:23:36
38@@ -98,6 +98,7 @@ int only_existing = 0;
11f96ec2
WD
39 int opt_ignore_existing = 0;
40 int need_messages_from_generator = 0;
41 int max_delete = 0;
42+OFF_T min_size = 0;
43 OFF_T max_size = 0;
44 int ignore_errors = 0;
45 int modify_window = 0;
489b0a72 46@@ -167,7 +168,7 @@ static int itemize_changes = 0;
11f96ec2
WD
47 static int refused_delete, refused_archive_part;
48 static int refused_partial, refused_progress, refused_delete_before;
994f69cd 49 static int refused_inplace;
11f96ec2
WD
50-static char *max_size_arg;
51+static char *min_size_arg, *max_size_arg;
52 static char partialdir_for_delayupdate[] = ".~tmp~";
53
54 /** Local address to bind. As a character string because it's
489b0a72 55@@ -308,6 +309,7 @@ void usage(enum logcode F)
11f96ec2
WD
56 rprintf(F," --ignore-errors delete even if there are I/O errors\n");
57 rprintf(F," --force force deletion of directories even if not empty\n");
58 rprintf(F," --max-delete=NUM don't delete more than NUM files\n");
59+ rprintf(F," --min-size=SIZE don't transfer any file smaller than SIZE\n");
60 rprintf(F," --max-size=SIZE don't transfer any file larger than SIZE\n");
61 rprintf(F," --partial keep partially transferred files\n");
62 rprintf(F," --partial-dir=DIR put a partially transferred file into DIR\n");
489b0a72 63@@ -362,7 +364,7 @@ void usage(enum logcode F)
5398d042
WD
64
65 enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM,
11f96ec2 66 OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST,
5398d042
WD
67- OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW,
68+ OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE,
69 OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE,
11f96ec2
WD
70 OPT_REFUSED_BASE = 9000};
71
489b0a72
WD
72@@ -417,6 +419,7 @@ static struct poptOption long_options[]
73 {"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 },
74 {"existing", 0, POPT_ARG_NONE, &only_existing, 0, 0, 0 },
75 {"ignore-existing", 0, POPT_ARG_NONE, &opt_ignore_existing, 0, 0, 0 },
11f96ec2
WD
76+ {"min-size", 0, POPT_ARG_STRING, &min_size_arg, OPT_MIN_SIZE, 0, 0 },
77 {"max-size", 0, POPT_ARG_STRING, &max_size_arg, OPT_MAX_SIZE, 0, 0 },
489b0a72
WD
78 {"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 },
79 {"inplace", 0, POPT_ARG_NONE, &inplace, 0, 0, 0 },
80@@ -874,6 +877,15 @@ int parse_arguments(int *argc, const cha
11f96ec2
WD
81 read_batch = 1;
82 break;
83
84+ case OPT_MIN_SIZE:
85+ if ((min_size = parse_size_arg(min_size_arg)) <= 0) {
86+ snprintf(err_buf, sizeof err_buf,
87+ "--min-size value is invalid: %s\n",
88+ min_size_arg);
89+ return 0;
90+ }
91+ break;
92+
93 case OPT_MAX_SIZE:
94 if ((max_size = parse_size_arg(max_size_arg)) <= 0) {
95 snprintf(err_buf, sizeof err_buf,
489b0a72 96@@ -1395,6 +1407,11 @@ void server_options(char **args,int *arg
11f96ec2
WD
97 args[ac++] = arg;
98 }
99
100+ if (min_size && am_sender) {
101+ args[ac++] = "--min-size";
102+ args[ac++] = min_size_arg;
103+ }
104+
105 if (max_size && am_sender) {
106 args[ac++] = "--max-size";
107 args[ac++] = max_size_arg;
489b0a72 108--- orig/rsync.yo 2005-08-27 21:05:12
dc6c50b2 109+++ rsync.yo 2005-05-06 19:12:35
489b0a72 110@@ -342,6 +342,7 @@ to the detailed description below for a
11f96ec2
WD
111 --ignore-errors delete even if there are I/O errors
112 --force force deletion of dirs even if not empty
113 --max-delete=NUM don't delete more than NUM files
114+ --min-size=SIZE don't transfer any file smaller than SIZE
115 --max-size=SIZE don't transfer any file larger than SIZE
116 --partial keep partially transferred files
117 --partial-dir=DIR put a partially transferred file into DIR
489b0a72 118@@ -794,10 +795,16 @@ dit(bf(--max-delete=NUM)) This tells rsy
11f96ec2
WD
119 files or directories (NUM must be non-zero).
120 This is useful when mirroring very large trees to prevent disasters.
121
122+dit(bf(--min-size=SIZE)) This tells rsync to avoid transferring any
dc6c50b2
WD
123+file that is smaller than the specified SIZE, which can help in not
124+transferring small, junk files.
125+
126+The SIZE value can be suffixed with a letter to indicate a size multiplier
127+(K, M, or G) and may be a fractional value (e.g. "bf(--min-size=2.5k)").
11f96ec2
WD
128+
129 dit(bf(--max-size=SIZE)) This tells rsync to avoid transferring any
dc6c50b2
WD
130-file that is larger than the specified SIZE. The SIZE value can be
131-suffixed with a letter to indicate a size multiplier (K, M, or G) and
132-may be a fractional value (e.g. "bf(--max-size=1.5m)").
133+file that is larger than the specified SIZE. See the bf(--min-size)
134+option for a description of SIZE.
135
136 dit(bf(-B, --block-size=BLOCKSIZE)) This forces the block size used in
137 the rsync algorithm to a fixed value. It is normally selected based on