summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2020-06-22 13:41:42 -0700
committerWayne Davison <wayne@opencoder.net>2020-06-22 13:41:42 -0700
commit3094552311b76a7316f6987ad5f21e28318b4313 (patch)
tree2545cd69f3c20ea97b90bcd7cbfdda92e49ff4ed
parente4c9ff5873dbeb5aa299824cd93bc598f1871518 (diff)
downloadrsync-3094552311b76a7316f6987ad5f21e28318b4313.tar.gz
Add `--zl=N` opt & improve its docs.
-rw-r--r--NEWS.md4
-rw-r--r--options.c1
-rw-r--r--rsync.1.md37
3 files changed, 38 insertions, 4 deletions
diff --git a/NEWS.md b/NEWS.md
index 5b8946aa..a2d9f0f0 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -29,6 +29,10 @@ Protocol: 31 (unchanged)
### ENHANCEMENTS:
+ - The use of `--backup-dir=STR` now implies `--backup`.
+
+ - Added `--zl=NUM` as a short-hand for `--compress-level=NUM`.
+
- Added `--early-input=FILE` option that allows the client to send some
data to a daemon's (optional) "early exec" script on its stdin.
diff --git a/options.c b/options.c
index 961cd48c..73d5ed47 100644
--- a/options.c
+++ b/options.c
@@ -945,6 +945,7 @@ static struct poptOption long_options[] = {
{"zc", 0, POPT_ARG_STRING, &compress_choice, 0, 0, 0 },
{"skip-compress", 0, POPT_ARG_STRING, &skip_compress, 0, 0, 0 },
{"compress-level", 0, POPT_ARG_INT, &do_compression_level, 0, 0, 0 },
+ {"zl", 0, POPT_ARG_INT, &do_compression_level, 0, 0, 0 },
{0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 },
{"progress", 0, POPT_ARG_VAL, &do_progress, 1, 0, 0 },
{"no-progress", 0, POPT_ARG_VAL, &do_progress, 0, 0, 0 },
diff --git a/rsync.1.md b/rsync.1.md
index 9acaed3c..71f1e88a 100644
--- a/rsync.1.md
+++ b/rsync.1.md
@@ -2311,11 +2311,40 @@ your home directory (remove the '=' for that).
enough to handle a compression negotiation list, the list is silently
ignored unless it contains the string "FAIL".
-0. `--compress-level=NUM`
+0. `--compress-level=NUM`, `--zl=NUM`
- Explicitly set the compression level to use (see `--compress`) instead of
- letting it default. If NUM is non-zero, the `--compress` option is
- implied.
+ Explicitly set the compression level to use (see `--compress`, `-z`)
+ instead of letting it default. The `--compress` option is implied as long
+ as the level chosen is not a "don't compress" level for the compression
+ algorithm that is in effect (e.g. zlib compression treats level 0 as
+ "off").
+
+ The level values vary depending on the checksum in effect. Because rsync
+ will negotiate a checksum choice by default when the remote rsync is new
+ enough, it can be good to combine this option with a `--compress-choice`
+ (`--zc`) option unless you're sure of the choice in effect. For example:
+
+ > rsync -aiv --zc=zstd --zl=22 host:src/ dest/
+
+ For zlib & zlibx compression, the valid values are from 1 to 9 with 6 being
+ the default. Specifying 0 turns compression off, and specifying -1 chooses
+ the default of 6.
+
+ For zstd compression, the valid values are from -131072 to 22 with 3 being
+ the default. Specifying 0 chooses the default of 3.
+
+ For lz4 compression, there are no levels available, so the level is always
+ 0.
+
+ If you specify a too-large or too-small value, the number is silently
+ limited to a valid value. This allows you to specify something like
+ `--zl=999999999` and be assured that you'll end up with the maximum
+ compression level no matter what algorithm was chosen.
+
+ If you want to know the compression level that is in effect, specify the
+ `--debug=nstr` to see the "negotiated string" results. This will report
+ something like "`Client compress: zstd (level 3)`" (along with the checksum
+ choice in effect).
0. `--skip-compress=LIST`