Annotation of embedaddon/rsync/patches/date-only.diff, revision 1.1
1.1 ! misho 1: Jeremy Bornstein wrote:
! 2:
! 3: I recently had the need to transfer files only with different mod
! 4: dates (and to *not* transfer them based on file size differences).
! 5: This is because I'm backing up files remotely on an untrusted machine,
! 6: so I'm encrypting them with gpg before transfer. I discovered that
! 7: rsync didn't already have a --date-only flag, so I added one and am
! 8: enclosing the diffs in case you (as I hope) decide to include this
! 9: option in future releases.
! 10:
! 11: To use this patch, run these commands for a successful build:
! 12:
! 13: patch -p1 <patches/date-only.diff
! 14: ./configure (optional if already run)
! 15: make
! 16:
! 17: based-on: e94bad1c156fc3910f24e2b3b71a81b0b0bdeb70
! 18: diff --git a/generator.c b/generator.c
! 19: --- a/generator.c
! 20: +++ b/generator.c
! 21: @@ -65,6 +65,7 @@ extern int append_mode;
! 22: extern int make_backups;
! 23: extern int csum_length;
! 24: extern int ignore_times;
! 25: +extern int date_only;
! 26: extern int size_only;
! 27: extern OFF_T max_size;
! 28: extern OFF_T min_size;
! 29: @@ -603,6 +604,9 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre
! 30: /* Perform our quick-check heuristic for determining if a file is unchanged. */
! 31: int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st)
! 32: {
! 33: + if (date_only)
! 34: + return !mtime_differs(st, file);
! 35: +
! 36: if (st->st_size != F_LENGTH(file))
! 37: return 0;
! 38:
! 39: diff --git a/options.c b/options.c
! 40: --- a/options.c
! 41: +++ b/options.c
! 42: @@ -110,6 +110,7 @@ int safe_symlinks = 0;
! 43: int copy_unsafe_links = 0;
! 44: int munge_symlinks = 0;
! 45: int size_only = 0;
! 46: +int date_only = 0;
! 47: int daemon_bwlimit = 0;
! 48: int bwlimit = 0;
! 49: int fuzzy_basis = 0;
! 50: @@ -679,6 +680,7 @@ static struct poptOption long_options[] = {
! 51: {"chmod", 0, POPT_ARG_STRING, 0, OPT_CHMOD, 0, 0 },
! 52: {"ignore-times", 'I', POPT_ARG_NONE, &ignore_times, 0, 0, 0 },
! 53: {"size-only", 0, POPT_ARG_NONE, &size_only, 0, 0, 0 },
! 54: + {"date-only", 0, POPT_ARG_NONE, &date_only, 0, 0, 0 },
! 55: {"one-file-system", 'x', POPT_ARG_NONE, 0, 'x', 0, 0 },
! 56: {"no-one-file-system",0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
! 57: {"no-x", 0, POPT_ARG_VAL, &one_file_system, 0, 0, 0 },
! 58: @@ -2782,6 +2784,9 @@ void server_options(char **args, int *argc_p)
! 59: else if (missing_args == 1 && !am_sender)
! 60: args[ac++] = "--ignore-missing-args";
! 61:
! 62: + if (date_only)
! 63: + args[ac++] = "--date-only";
! 64: +
! 65: if (modify_window_set && am_sender) {
! 66: char *fmt = modify_window < 0 ? "-@%d" : "--modify-window=%d";
! 67: if (asprintf(&arg, fmt, modify_window) < 0)
! 68: diff --git a/rsync.1.md b/rsync.1.md
! 69: --- a/rsync.1.md
! 70: +++ b/rsync.1.md
! 71: @@ -418,6 +418,7 @@ detailed description below for a complete description.
! 72: --contimeout=SECONDS set daemon connection timeout in seconds
! 73: --ignore-times, -I don't skip files that match size and time
! 74: --size-only skip files that match in size
! 75: +--date-only skip files that match in mod-time
! 76: --modify-window=NUM, -@ set the accuracy for mod-time comparisons
! 77: --temp-dir=DIR, -T create temporary files in directory DIR
! 78: --fuzzy, -y find similar file for basis if no dest file
! 79: @@ -660,6 +661,14 @@ your home directory (remove the '=' for that).
! 80: after using another mirroring system which may not preserve timestamps
! 81: exactly.
! 82:
! 83: +0. `--date-only`
! 84: +
! 85: + Normally rsync will skip any files that are already the same size and have
! 86: + the same modification time-stamp. With the --date-only option, files will
! 87: + be skipped if they have the same timestamp, regardless of size. This may be
! 88: + useful when the remote files have passed through a size-changing filter,
! 89: + e.g. for encryption.
! 90: +
! 91: 0. `--modify-window=NUM`, `-@`
! 92:
! 93: When comparing two timestamps, rsync treats the timestamps as being equal
! 94: diff -Nurp a/rsync.1 b/rsync.1
! 95: --- a/rsync.1
! 96: +++ b/rsync.1
! 97: @@ -494,6 +494,7 @@ detailed description below for a complet
! 98: --contimeout=SECONDS set daemon connection timeout in seconds
! 99: --ignore-times, -I don't skip files that match size and time
! 100: --size-only skip files that match in size
! 101: +--date-only skip files that match in mod-time
! 102: --modify-window=NUM, -@ set the accuracy for mod-time comparisons
! 103: --temp-dir=DIR, -T create temporary files in directory DIR
! 104: --fuzzy, -y find similar file for basis if no dest file
! 105: @@ -727,6 +728,12 @@ either a changed size or a changed last-
! 106: files that have changed in size. This is useful when starting to use rsync
! 107: after using another mirroring system which may not preserve timestamps
! 108: exactly.
! 109: +.IP "\fB\-\-date-only\fP"
! 110: +Normally rsync will skip any files that are already the same size and have
! 111: +the same modification time-stamp. With the \-\-date-only option, files will
! 112: +be skipped if they have the same timestamp, regardless of size. This may be
! 113: +useful when the remote files have passed through a size-changing filter,
! 114: +e.g. for encryption.
! 115: .IP "\fB\-\-modify-window=NUM\fP, \fB\-@\fP"
! 116: When comparing two timestamps, rsync treats the timestamps as being equal
! 117: if they differ by no more than the modify-window value. The default is 0,
! 118: diff -Nurp a/rsync.1.html b/rsync.1.html
! 119: --- a/rsync.1.html
! 120: +++ b/rsync.1.html
! 121: @@ -409,6 +409,7 @@ detailed description below for a complet
! 122: --contimeout=SECONDS set daemon connection timeout in seconds
! 123: --ignore-times, -I don't skip files that match size and time
! 124: --size-only skip files that match in size
! 125: +--date-only skip files that match in mod-time
! 126: --modify-window=NUM, -@ set the accuracy for mod-time comparisons
! 127: --temp-dir=DIR, -T create temporary files in directory DIR
! 128: --fuzzy, -y find similar file for basis if no dest file
! 129: @@ -646,6 +647,14 @@ after using another mirroring system whi
! 130: exactly.</p>
! 131: </dd>
! 132:
! 133: +<dt><code>--date-only</code></dt><dd>
! 134: +<p>Normally rsync will skip any files that are already the same size and have
! 135: +the same modification time-stamp. With the -⁠-⁠date-only option, files will
! 136: +be skipped if they have the same timestamp, regardless of size. This may be
! 137: +useful when the remote files have passed through a size-changing filter,
! 138: +e.g. for encryption.</p>
! 139: +</dd>
! 140: +
! 141: <dt><code>--modify-window=NUM</code>, <code>-@</code></dt><dd>
! 142: <p>When comparing two timestamps, rsync treats the timestamps as being equal
! 143: if they differ by no more than the modify-window value. The default is 0,
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>