diff --git a/src/doc/man/cargo-vendor.md b/src/doc/man/cargo-vendor.md index f7c4532035c..917031bcc03 100644 --- a/src/doc/man/cargo-vendor.md +++ b/src/doc/man/cargo-vendor.md @@ -27,7 +27,7 @@ to use the vendored sources, which you will need to add to `.cargo/config.toml`. {{#option "`-s` _manifest_" "`--sync` _manifest_" }} Specify extra `Cargo.toml` manifests to workspaces which should also be -vendored and synced to the output. +vendored and synced to the output. Terminate the list with `--`. {{/option}} {{#option "`--no-delete`" }} diff --git a/tests/testsuite/vendor.rs b/tests/testsuite/vendor.rs index 947ff324fa8..6860708fa9f 100644 --- a/tests/testsuite/vendor.rs +++ b/tests/testsuite/vendor.rs @@ -309,6 +309,71 @@ 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: failed to read [..] + +Caused by: + No such file or directory (os error 2) +", + ) + .with_status(101) + .run(); + + p.cargo("vendor --respect-source-config --manifest-path foo/Cargo.toml -s bar/Cargo.toml 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()