]> git.proxmox.com Git - cargo.git/commitdiff
vendor: Don't allow multiple values for --sync
authorAndrew Eikum <aeikum@codeweavers.com>
Wed, 2 Mar 2022 14:41:44 +0000 (08:41 -0600)
committerAndrew Eikum <aeikum@codeweavers.com>
Fri, 11 Mar 2022 16:41:12 +0000 (10:41 -0600)
src/bin/cargo/commands/vendor.rs
src/doc/man/cargo-vendor.md
src/doc/man/generated_txt/cargo-vendor.txt
src/doc/src/commands/cargo-vendor.md
src/etc/man/cargo-vendor.1
tests/testsuite/vendor.rs

index 697c235412c06c3171a6105ba352f9a14ce56926..88726697e22725a783acdd259da0cc1a556b7710 100644 (file)
@@ -24,8 +24,7 @@ pub fn cli() -> App {
                 .help("Additional `Cargo.toml` to sync and vendor")
                 .value_name("TOML")
                 .allow_invalid_utf8(true)
-                .multiple_occurrences(true)
-                .multiple_values(true),
+                .multiple_occurrences(true),
         )
         .arg(
             Arg::new("respect-source-config")
index f7c4532035c2ae95c8cf375012085142ec8b5411..9fd977951e75610a601835786623dcc918f889a7 100644 (file)
@@ -26,8 +26,8 @@ to use the vendored sources, which you will need to add to `.cargo/config.toml`.
 {{#options}}
 
 {{#option "`-s` _manifest_" "`--sync` _manifest_" }}
-Specify extra `Cargo.toml` manifests to workspaces which should also be
-vendored and synced to the output.
+Specify an extra `Cargo.toml` manifest to workspaces which should also be
+vendored and synced to the output. May be specified multiple times.
 {{/option}}
 
 {{#option "`--no-delete`" }}
index 6004360bc0e2a82c379904ab4d2425a86224efb7..cfda5c3c80896ef24742f84fb165ca2296164eec 100644 (file)
@@ -20,8 +20,9 @@ DESCRIPTION
 OPTIONS
    Vendor Options
        -s manifest, --sync manifest
-           Specify extra Cargo.toml manifests to workspaces which should also
-           be vendored and synced to the output.
+           Specify an extra Cargo.toml manifest to workspaces which should also
+           be vendored and synced to the output. May be specified multiple
+           times.
 
        --no-delete
            Don't delete the "vendor" directory when vendoring, but rather keep
index b1c6f858a37eef697d3f526ae8ff939d00edf150..ec6890724772622e2b50d6aa7d4eb9055eea46fe 100644 (file)
@@ -27,8 +27,8 @@ to use the vendored sources, which you will need to add to `.cargo/config.toml`.
 
 <dt class="option-term" id="option-cargo-vendor--s"><a class="option-anchor" href="#option-cargo-vendor--s"></a><code>-s</code> <em>manifest</em></dt>
 <dt class="option-term" id="option-cargo-vendor---sync"><a class="option-anchor" href="#option-cargo-vendor---sync"></a><code>--sync</code> <em>manifest</em></dt>
-<dd class="option-desc">Specify extra <code>Cargo.toml</code> manifests to workspaces which should also be
-vendored and synced to the output.</dd>
+<dd class="option-desc">Specify an extra <code>Cargo.toml</code> manifest to workspaces which should also be
+vendored and synced to the output. May be specified multiple times.</dd>
 
 
 <dt class="option-term" id="option-cargo-vendor---no-delete"><a class="option-anchor" href="#option-cargo-vendor---no-delete"></a><code>--no-delete</code></dt>
index eeaf740467bbf25c0fcb11ad73c562f46c99f186..180d36a9b46236850944e69f733c95f0feaf4446 100644 (file)
@@ -22,8 +22,8 @@ to use the vendored sources, which you will need to add to \fB\&.cargo/config.to
 \fB\-s\fR \fImanifest\fR, 
 \fB\-\-sync\fR \fImanifest\fR
 .RS 4
-Specify extra \fBCargo.toml\fR manifests to workspaces which should also be
-vendored and synced to the output.
+Specify an extra \fBCargo.toml\fR manifest to workspaces which should also be
+vendored and synced to the output. May be specified multiple times.
 .RE
 .sp
 \fB\-\-no\-delete\fR
index 947ff324fa856190bd83ac599cab0556dd0216e4..06feb5056b1ad5a1e9e807032b0e500650b1c6a3 100644 (file)
@@ -309,6 +309,72 @@ fn two_lockfiles() {
     p.cargo("build").cwd("bar").run();
 }
 
+#[cargo_test]
+fn test_sync_argument() {
+    let p = project()
+        .no_manifest()
+        .file(
+            "foo/Cargo.toml",
+            r#"
+                [package]
+                name = "foo"
+                version = "0.1.0"
+
+                [dependencies]
+                bitflags = "=0.7.0"
+            "#,
+        )
+        .file("foo/src/lib.rs", "")
+        .file(
+            "bar/Cargo.toml",
+            r#"
+                [package]
+                name = "bar"
+                version = "0.1.0"
+
+                [dependencies]
+                bitflags = "=0.8.0"
+            "#,
+        )
+        .file("bar/src/lib.rs", "")
+        .file(
+            "baz/Cargo.toml",
+            r#"
+                [package]
+                name = "baz"
+                version = "0.1.0"
+
+                [dependencies]
+                bitflags = "=0.8.0"
+            "#,
+        )
+        .file("baz/src/lib.rs", "")
+        .build();
+
+    Package::new("bitflags", "0.7.0").publish();
+    Package::new("bitflags", "0.8.0").publish();
+
+    p.cargo("vendor --respect-source-config --manifest-path foo/Cargo.toml -s bar/Cargo.toml baz/Cargo.toml test_vendor")
+        .with_stderr("\
+error: Found argument 'test_vendor' which wasn't expected, or isn't valid in this context
+
+USAGE:
+    cargo[EXE] vendor [OPTIONS] [path]
+
+For more information try --help",
+        )
+        .with_status(1)
+        .run();
+
+    p.cargo("vendor --respect-source-config --manifest-path foo/Cargo.toml -s bar/Cargo.toml -s baz/Cargo.toml test_vendor")
+        .run();
+
+    let lock = p.read_file("test_vendor/bitflags/Cargo.toml");
+    assert!(lock.contains("version = \"0.8.0\""));
+    let lock = p.read_file("test_vendor/bitflags-0.7.0/Cargo.toml");
+    assert!(lock.contains("version = \"0.7.0\""));
+}
+
 #[cargo_test]
 fn delete_old_crates() {
     let p = project()