Updated the format using the new verify-patches script.
[rsync/rsync-patches.git] / dir-times.diff
CommitLineData
13bed3dd
WD
1--- orig/options.c 2004-06-20 19:30:00
2+++ options.c 2004-07-03 20:17:33
7628f156 3@@ -48,6 +48,7 @@ int preserve_devices = 0;
6de33581
WD
4 int preserve_uid = 0;
5 int preserve_gid = 0;
6 int preserve_times = 0;
7+int preserve_dir_times = 0;
8 int update_only = 0;
9 int cvs_exclude = 0;
10 int dry_run = 0;
7628f156 11@@ -244,7 +245,8 @@ void usage(enum logcode F)
6de33581
WD
12 rprintf(F," -o, --owner preserve owner (root only)\n");
13 rprintf(F," -g, --group preserve group\n");
14 rprintf(F," -D, --devices preserve devices (root only)\n");
15- rprintf(F," -t, --times preserve times\n");
16+ rprintf(F," -t, --times preserve times on non-directories\n");
17+ rprintf(F," -d, --dir-times preserve times on directories\n");
18 rprintf(F," -S, --sparse handle sparse files efficiently\n");
19 rprintf(F," -n, --dry-run show what would have been transferred\n");
20 rprintf(F," -W, --whole-file copy whole files, no incremental checks\n");
7628f156 21@@ -352,6 +354,7 @@ static struct poptOption long_options[]
6de33581
WD
22 {"group", 'g', POPT_ARG_NONE, &preserve_gid, 0, 0, 0 },
23 {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 },
24 {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 },
25+ {"dir-times", 'd', POPT_ARG_NONE, &preserve_dir_times, 0, 0, 0 },
26 {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 },
27 {"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 },
28 {"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 },
7628f156 29@@ -841,6 +844,8 @@ void server_options(char **args,int *arg
6de33581
WD
30 argstr[x++] = 'D';
31 if (preserve_times)
32 argstr[x++] = 't';
33+ if (preserve_dir_times && am_sender)
34+ argstr[x++] = 'd';
35 if (preserve_perms)
36 argstr[x++] = 'p';
37 if (recurse)
13bed3dd
WD
38--- orig/rsync.c 2004-07-02 18:06:32
39+++ rsync.c 2004-07-03 20:17:33
7f2baf27
WD
40@@ -25,6 +25,7 @@
41 extern int verbose;
42 extern int dry_run;
43 extern int preserve_times;
44+extern int preserve_dir_times;
45 extern int am_root;
46 extern int am_sender;
47 extern int am_generator;
7b675ff5 48@@ -140,15 +141,16 @@ int set_perms(char *fname,struct file_st
6de33581
WD
49 st = &st2;
50 }
51
7b675ff5
WD
52- if (!preserve_times || S_ISLNK(st->st_mode)
53- || (make_backups && !backup_dir && S_ISDIR(st->st_mode)))
7f2baf27 54- flags |= PERMS_SKIP_MTIME;
6de33581 55+ if (S_ISDIR(st->st_mode)) {
7b675ff5 56+ if (!preserve_dir_times || (make_backups && !backup_dir))
7f2baf27 57+ flags |= PERMS_SKIP_MTIME;
6de33581
WD
58+ } else {
59+ if (!preserve_times || S_ISLNK(st->st_mode))
7f2baf27 60+ flags |= PERMS_SKIP_MTIME;
6de33581 61+ }
7f2baf27 62 if (!(flags & PERMS_SKIP_MTIME)
6de33581
WD
63 && cmp_modtime(st->st_mtime, file->modtime) != 0) {
64- /* don't complain about not setting times on directories
65- * because some filesystems can't do it */
66- if (set_modtime(fname,file->modtime) != 0 &&
67- !S_ISDIR(st->st_mode)) {
68+ if (set_modtime(fname,file->modtime) != 0) {
fe6407b5
WD
69 rsyserr(FERROR, errno, "failed to set times on %s",
70 full_fname(fname));
6de33581 71 return 0;
13bed3dd
WD
72--- orig/rsync.yo 2004-06-17 06:32:00
73+++ rsync.yo 2004-07-03 20:17:33
7628f156 74@@ -299,7 +299,8 @@ verb(
6de33581
WD
75 -o, --owner preserve owner (root only)
76 -g, --group preserve group
77 -D, --devices preserve devices (root only)
78- -t, --times preserve times
79+ -t, --times preserve times on non-directories
80+ -d, --dir-times preserve times on directories
81 -S, --sparse handle sparse files efficiently
82 -n, --dry-run show what would have been transferred
83 -W, --whole-file copy whole files, no incremental checks
7628f156 84@@ -544,14 +545,23 @@ dit(bf(-D, --devices)) This option cause
6de33581
WD
85 block device information to the remote system to recreate these
86 devices. This option is only available to the super-user.
87
88-dit(bf(-t, --times)) This tells rsync to transfer modification times along
89-with the files and update them on the remote system. Note that if this
90+dit(bf(-t, --times)) This tells rsync to preserve modification times of
91+non-directories transferred to the remote system. Note that if this
92 option is not used, the optimization that excludes files that have not been
93 modified cannot be effective; in other words, a missing -t or -a will
94 cause the next transfer to behave as if it used -I, and all files will have
95 their checksums compared and show up in log messages even if they haven't
96 changed.
7b675ff5 97
6de33581
WD
98+dit(bf(-d, --dir-times)) This tells rsync to preserve the modification
99+times of directories transferred to the remote system. On a modern
100+rsync, these are left unpreserved by default to avoid causing problems
101+for NFS.
102+
103+Note: when sending files to an older rsync, the --times option will
104+imply --dir-times (if the option causes an error on the receiving
105+system, omit it and use --times to preserve all file/directory times).
7b675ff5 106+
6de33581
WD
107 dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers,
108 instead it will just report the actions it would have taken.
7b675ff5 109
13bed3dd
WD
110--- orig/testsuite/chgrp.test 2004-05-21 23:56:27
111+++ testsuite/chgrp.test 2004-07-03 20:17:33
7d2d2057 112@@ -26,7 +26,7 @@ do
6de33581
WD
113 done
114 sleep 2
115
f0533c4c
WD
116-checkit "$RSYNC -rtgpvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
117+checkit "$RSYNC -rtdgpvvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
6de33581
WD
118
119 # The script would have aborted on error, so getting here means we've won.
120 exit 0
13bed3dd
WD
121--- orig/testsuite/chown.test 2004-05-18 09:14:24
122+++ testsuite/chown.test 2004-07-03 20:17:33
7d2d2057 123@@ -28,7 +28,7 @@ chown 5001 "$name2" || test_skipped "Can
6de33581
WD
124 chgrp 5002 "$name1" || test_skipped "Can't chgrp (probably need root)"
125 chgrp 5003 "$name2" || test_skipped "Can't chgrp (probably need root)"
126
127-checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
128+checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
129
130 # The script would have aborted on error, so getting here means we've won.
131 exit 0
13bed3dd
WD
132--- orig/testsuite/daemon-gzip-download.test 2004-05-18 09:14:24
133+++ testsuite/daemon-gzip-download.test 2004-07-03 20:17:33
7d2d2057 134@@ -29,9 +29,9 @@ export RSYNC_CONNECT_PROG
6de33581 135 hands_setup
7d2d2057
WD
136
137 # Build chkdir with a normal rsync and an --exclude.
138-$RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/"
139+$RSYNC -adv --exclude=foobar.baz "$fromdir/" "$chkdir/"
140
141-checkit "$RSYNC -avvvvz localhost::test-from/ \"$todir/\"" "$chkdir" "$todir"
142+checkit "$RSYNC -advvvvz localhost::test-from/ \"$todir/\"" "$chkdir" "$todir"
6de33581
WD
143
144 # The script would have aborted on error, so getting here means we've won.
145 exit 0
13bed3dd
WD
146--- orig/testsuite/daemon-gzip-upload.test 2004-05-18 09:14:24
147+++ testsuite/daemon-gzip-upload.test 2004-07-03 20:17:33
7d2d2057 148@@ -23,9 +23,9 @@ export RSYNC_CONNECT_PROG
6de33581 149 hands_setup
7d2d2057
WD
150
151 # Build chkdir with a normal rsync and an --exclude.
152-$RSYNC -av --exclude=foobar.baz "$fromdir/" "$chkdir/"
153+$RSYNC -adv --exclude=foobar.baz "$fromdir/" "$chkdir/"
154
155-checkit "$RSYNC -avvvvz \"$fromdir/\" localhost::test-to/" "$chkdir" "$todir"
156+checkit "$RSYNC -advvvvz \"$fromdir/\" localhost::test-to/" "$chkdir" "$todir"
6de33581
WD
157
158 # The script would have aborted on error, so getting here means we've won.
159 exit 0
13bed3dd
WD
160--- orig/testsuite/devices.test 2004-05-18 09:14:24
161+++ testsuite/devices.test 2004-07-03 20:17:33
7d2d2057 162@@ -29,7 +29,7 @@ mknod "$fromdir/block" b 42 69 || test_s
6de33581
WD
163 mknod "$fromdir/block2" b 42 73 || test_skipped "Can't create block device node unless root"
164 mknod "$fromdir/block3" b 105 73 || test_skipped "Can't create block device node unless root"
165
166-checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
167+checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
168
169 # The script would have aborted on error, so getting here means we've won.
170 exit 0
13bed3dd
WD
171--- orig/testsuite/duplicates.test 2004-05-18 09:14:24
172+++ testsuite/duplicates.test 2004-07-03 20:17:33
7d2d2057 173@@ -33,7 +33,7 @@ ln -s "$name1" "$name2" || fail "can't c
6de33581
WD
174
175 outfile="$scratchdir/rsync.out"
176
177-checkit "$RSYNC -avv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
178+checkit "$RSYNC -advv \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir" \
179 | tee "$outfile"
180
181 # Make sure each file was only copied once...
13bed3dd
WD
182--- orig/testsuite/exclude.test 2004-05-29 21:25:45
183+++ testsuite/exclude.test 2004-07-03 20:17:33
78114162 184@@ -66,7 +66,7 @@ EOF
6de33581
WD
185
186 # Create the chk dir with what we expect to be excluded
187
188-checkit "$RSYNC -avv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir"
189+checkit "$RSYNC -advv \"$fromdir/\" \"$chkdir/\"" "$fromdir" "$chkdir"
190
191 sleep 1 # Ensures that the rm commands will tweak the directory times.
192
78114162 193@@ -78,11 +78,11 @@ rm "$chkdir"/mid/for/foo/extra
6de33581
WD
194
195 # Un-tweak the directory times in our first (weak) exclude test (though
196 # it's a good test of the --existing option).
197-$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
198+$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
199
200 # Now, test if rsync excludes the same files.
201
78114162
WD
202-checkit "$RSYNC -avv --exclude-from=\"$excl\" \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
203+checkit "$RSYNC -advv --exclude-from=\"$excl\" \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
6de33581
WD
204
205 # Modify the chk dir by removing cvs-ignored files and then tweaking the dir times.
206
78114162 207@@ -92,12 +92,12 @@ rm "$chkdir"/bar/down/to/foo/*.junk
6de33581
WD
208 rm "$chkdir"/bar/down/to/home-cvs-exclude
209 rm "$chkdir"/mid/one-in-one-out
210
211-$RSYNC -av --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
212+$RSYNC -adv --existing --include='*/' --exclude='*' "$fromdir/" "$chkdir/"
213
214 # Now, test if rsync excludes the same files, this time with --cvs-exclude
215 # and --delete-excluded.
216
78114162
WD
217-checkit "$RSYNC -avvC --exclude-from=\"$excl\" \
218+checkit "$RSYNC -advvC --exclude-from=\"$excl\" \
219 --delete-excluded \"$fromdir/\" \"$todir/\"" "$chkdir" "$todir"
6de33581
WD
220
221 # The script would have aborted on error, so getting here means we've won.
13bed3dd
WD
222--- orig/testsuite/hands.test 2004-05-18 09:14:24
223+++ testsuite/hands.test 2004-07-03 20:17:33
6de33581
WD
224@@ -11,19 +11,19 @@ hands_setup
225
226 # Main script starts here
227
7d2d2057
WD
228-runtest "basic operation" 'checkit "$RSYNC -av \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
229+runtest "basic operation" 'checkit "$RSYNC -adv \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
6de33581 230
7d2d2057
WD
231 ln "$fromdir/filelist" "$fromdir/dir"
232-runtest "hard links" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
233+runtest "hard links" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
6de33581 234
7d2d2057
WD
235 rm "$todir/text"
236-runtest "one file" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
237+runtest "one file" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
6de33581 238
7d2d2057
WD
239 echo "extra line" >> "$todir/text"
240-runtest "extra data" 'checkit "$RSYNC -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
241+runtest "extra data" 'checkit "$RSYNC -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
6de33581 242
7d2d2057
WD
243 cp "$fromdir/text" "$todir/ThisShouldGo"
244-runtest " --delete" 'checkit "$RSYNC --delete -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
245+runtest " --delete" 'checkit "$RSYNC --delete -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"'
6de33581
WD
246
247 # The script would have aborted on error, so getting here means we've won.
248 exit 0
13bed3dd
WD
249--- orig/testsuite/hardlinks.test 2004-05-18 09:14:24
250+++ testsuite/hardlinks.test 2004-07-03 20:17:33
6de33581
WD
251@@ -31,7 +31,7 @@ ln "$name1" "$name2" || fail "Can't crea
252 ln "$name2" "$name3" || fail "Can't create hardlink"
253 cp "$name2" "$name4" || fail "Can't copy file"
254
255-checkit "$RSYNC -aHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
256+checkit "$RSYNC -adHvv \"$fromdir/\" \"$todir/\"" "$fromdir" "$todir"
257
258 # The script would have aborted on error, so getting here means we've won.
259 exit 0
13bed3dd
WD
260--- orig/testsuite/longdir.test 2004-05-18 09:50:26
261+++ testsuite/longdir.test 2004-07-03 20:17:33
7d2d2057
WD
262@@ -18,7 +18,7 @@ makepath "$longdir" || test_skipped "una
263 touch "$longdir/1" || test_skipped "unable to create files in long directory"
264 date > "$longdir/1"
265 ls -la / > "$longdir/2"
266-checkit "$RSYNC --delete -avH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"
267+checkit "$RSYNC --delete -advH \"$fromdir/\" \"$todir\"" "$fromdir/" "$todir"
6de33581
WD
268
269 # The script would have aborted on error, so getting here means we've won.
270 exit 0
13bed3dd
WD
271--- orig/testsuite/merge.test 2004-05-18 09:14:24
272+++ testsuite/merge.test 2004-07-03 20:17:33
7d2d2057 273@@ -40,9 +40,9 @@ cp -p "$from2dir"/sub1/uno "$from3dir"/s
6de33581
WD
274 cp -p "$from3dir"/sub2/subby "$chkdir"/sub2
275
276 # Get rid of any directory-time differences
277-$RSYNC -av --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/"
278+$RSYNC -adv --existing --include='*/' --exclude='*' "$from1dir/" "$from2dir/" "$from3dir/" "$chkdir/"
279
280-checkit "$RSYNC -aHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
281+checkit "$RSYNC -adHvv \"$from1dir/\" \"$from2dir/\" \"$from3dir/\" \"$todir/\"" "$chkdir" "$todir"
282
283 # The script would have aborted on error, so getting here means we've won.
284 exit 0
13bed3dd
WD
285--- orig/testsuite/ssh-basic.test 2004-05-18 09:14:24
286+++ testsuite/ssh-basic.test 2004-07-03 20:17:33
6de33581
WD
287@@ -28,7 +28,7 @@ fi
288 # nothing to do.
289 hands_setup
290
7d2d2057
WD
291-runtest "ssh: basic test" 'checkit "$RSYNC -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
292+runtest "ssh: basic test" 'checkit "$RSYNC -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
6de33581
WD
293
294 # Added by Steve Bonds Feb 2 2003
295 # I assumed that "F1" was intended to hold a single file for testing if
7d2d2057 296@@ -40,4 +40,4 @@ F1=`ls "$todir" | head -5 | tail -1`
6de33581 297
7d2d2057 298 mv "$todir/$F1" "$todir/ThisShouldGo"
6de33581 299
7d2d2057
WD
300-runtest "ssh: renamed file" 'checkit "$RSYNC --delete -avH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
301+runtest "ssh: renamed file" 'checkit "$RSYNC --delete -advH -e ssh --rsync-path=$RSYNC \"$fromdir/\" \"localhost:$todir\"" "$fromdir/" "$todir"'
13bed3dd
WD
302--- orig/testsuite/unsafe-links.test 2004-05-18 09:14:24
303+++ testsuite/unsafe-links.test 2004-07-03 20:17:33
6de33581
WD
304@@ -35,33 +35,33 @@ ln -s ../../unsafe/unsafefile "from/safe
305 set -x
306
307 echo "rsync with relative path and just -a";
308-$RSYNC -avv from/safe/ to
309+$RSYNC -advv from/safe/ to
310 test_symlink to/links/file1
311 test_symlink to/links/file2
312 test_symlink to/links/unsafefile
313
314 echo "rsync with relative path and -a --copy-links"
315-$RSYNC -avv --copy-links from/safe/ to
316+$RSYNC -advv --copy-links from/safe/ to
317 test_regular to/links/file1
318 test_regular to/links/file2
319 test_regular to/links/unsafefile
320
321 echo "rsync with relative path and --copy-unsafe-links";
322-$RSYNC -avv --copy-unsafe-links from/safe/ to
323+$RSYNC -advv --copy-unsafe-links from/safe/ to
324 test_symlink to/links/file1
325 test_symlink to/links/file2
326 test_regular to/links/unsafefile
327
328 rm -rf to
329 echo "rsync with relative2 path";
330-(cd from; $RSYNC -avv --copy-unsafe-links safe/ ../to)
331+(cd from; $RSYNC -advv --copy-unsafe-links safe/ ../to)
332 test_symlink to/links/file1
333 test_symlink to/links/file2
334 test_regular to/links/unsafefile
335
336 rm -rf to
337 echo "rsync with absolute path";
338-$RSYNC -avv --copy-unsafe-links `pwd`/from/safe/ to
339+$RSYNC -advv --copy-unsafe-links `pwd`/from/safe/ to
340 test_symlink to/links/file1
341 test_symlink to/links/file2
342 test_regular to/links/unsafefile