| 1 | --- orig/options.c 2004-11-27 18:27:35 |
| 2 | +++ options.c 2004-12-03 23:24:19 |
| 3 | @@ -48,6 +48,7 @@ int preserve_devices = 0; |
| 4 | int preserve_uid = 0; |
| 5 | int preserve_gid = 0; |
| 6 | int preserve_times = 0; |
| 7 | +int omit_dir_times = 0; |
| 8 | int update_only = 0; |
| 9 | int cvs_exclude = 0; |
| 10 | int dry_run = 0; |
| 11 | @@ -260,6 +261,7 @@ void usage(enum logcode F) |
| 12 | rprintf(F," -g, --group preserve group\n"); |
| 13 | rprintf(F," -D, --devices preserve devices (root only)\n"); |
| 14 | rprintf(F," -t, --times preserve times\n"); |
| 15 | + rprintf(F," -d, --omit-dir-times omit directories when preserving times\n"); |
| 16 | rprintf(F," -S, --sparse handle sparse files efficiently\n"); |
| 17 | rprintf(F," -n, --dry-run show what would have been transferred\n"); |
| 18 | rprintf(F," -W, --whole-file copy whole files, no incremental checks\n"); |
| 19 | @@ -365,6 +367,7 @@ static struct poptOption long_options[] |
| 20 | {"group", 'g', POPT_ARG_NONE, &preserve_gid, 0, 0, 0 }, |
| 21 | {"devices", 'D', POPT_ARG_NONE, &preserve_devices, 0, 0, 0 }, |
| 22 | {"times", 't', POPT_ARG_NONE, &preserve_times, 0, 0, 0 }, |
| 23 | + {"omit-dir-times", 'd', POPT_ARG_NONE, &omit_dir_times, 0, 0, 0 }, |
| 24 | {"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 }, |
| 25 | {"verbose", 'v', POPT_ARG_NONE, 0, 'v', 0, 0 }, |
| 26 | {"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 }, |
| 27 | @@ -1080,6 +1083,8 @@ void server_options(char **args,int *arg |
| 28 | argstr[x++] = 'D'; |
| 29 | if (preserve_times) |
| 30 | argstr[x++] = 't'; |
| 31 | + if (omit_dir_times && am_sender) |
| 32 | + argstr[x++] = 'd'; |
| 33 | if (preserve_perms) |
| 34 | argstr[x++] = 'p'; |
| 35 | if (recurse) |
| 36 | --- orig/rsync.c 2004-09-07 21:45:30 |
| 37 | +++ rsync.c 2004-12-03 23:32:45 |
| 38 | @@ -25,6 +25,7 @@ |
| 39 | extern int verbose; |
| 40 | extern int dry_run; |
| 41 | extern int preserve_times; |
| 42 | +extern int omit_dir_times; |
| 43 | extern int am_root; |
| 44 | extern int am_sender; |
| 45 | extern int am_generator; |
| 46 | @@ -143,14 +144,12 @@ int set_perms(char *fname,struct file_st |
| 47 | } |
| 48 | |
| 49 | if (!preserve_times || S_ISLNK(st->st_mode) |
| 50 | - || (make_backups && !backup_dir && S_ISDIR(st->st_mode))) |
| 51 | + || (S_ISDIR(st->st_mode) |
| 52 | + && (omit_dir_times || (make_backups && !backup_dir)))) |
| 53 | flags |= PERMS_SKIP_MTIME; |
| 54 | if (!(flags & PERMS_SKIP_MTIME) |
| 55 | && cmp_modtime(st->st_mtime, file->modtime) != 0) { |
| 56 | - /* don't complain about not setting times on directories |
| 57 | - * because some filesystems can't do it */ |
| 58 | - if (set_modtime(fname,file->modtime) != 0 && |
| 59 | - !S_ISDIR(st->st_mode)) { |
| 60 | + if (set_modtime(fname,file->modtime) != 0) { |
| 61 | rsyserr(FERROR, errno, "failed to set times on %s", |
| 62 | full_fname(fname)); |
| 63 | return 0; |
| 64 | --- orig/rsync.yo 2004-12-03 23:06:59 |
| 65 | +++ rsync.yo 2004-12-03 23:28:07 |
| 66 | @@ -330,6 +330,7 @@ verb( |
| 67 | -g, --group preserve group |
| 68 | -D, --devices preserve devices (root only) |
| 69 | -t, --times preserve times |
| 70 | + -d, --omit-dir-times omit directories when preserving times |
| 71 | -S, --sparse handle sparse files efficiently |
| 72 | -n, --dry-run show what would have been transferred |
| 73 | -W, --whole-file copy whole files, no incremental checks |
| 74 | @@ -627,6 +628,10 @@ cause the next transfer to behave as if |
| 75 | updated (though the rsync algorithm will make the update fairly efficient |
| 76 | if the files haven't actually changed, you're much better off using -t). |
| 77 | |
| 78 | +dit(bf(-d, --omit-dir-times)) This tells rsync to omit directories when |
| 79 | +the preserving of modification times is enabled (see --times). If NFS |
| 80 | +is sharing the files on the receiving end, it is a good idea to use -d. |
| 81 | + |
| 82 | dit(bf(-n, --dry-run)) This tells rsync to not do any file transfers, |
| 83 | instead it will just report the actions it would have taken. |
| 84 | |