2019-11-25 02:42:45 +00:00
|
|
|
//! Tests for including `Cargo.lock` when publishing/packaging.
|
|
|
|
|
2019-04-05 20:25:08 +00:00
|
|
|
use std::fs::File;
|
|
|
|
|
2019-09-12 17:14:29 +00:00
|
|
|
use cargo_test_support::registry::Package;
|
|
|
|
use cargo_test_support::{
|
2019-04-07 21:58:56 +00:00
|
|
|
basic_manifest, cargo_process, git, paths, project, publish::validate_crate_contents,
|
|
|
|
};
|
|
|
|
|
|
|
|
fn pl_manifest(name: &str, version: &str, extra: &str) -> String {
|
|
|
|
format!(
|
|
|
|
r#"
|
2019-06-10 19:38:51 +00:00
|
|
|
[package]
|
2019-04-07 21:58:56 +00:00
|
|
|
name = "{}"
|
|
|
|
version = "{}"
|
|
|
|
authors = []
|
|
|
|
license = "MIT"
|
|
|
|
description = "foo"
|
|
|
|
documentation = "foo"
|
|
|
|
homepage = "foo"
|
|
|
|
repository = "foo"
|
|
|
|
|
|
|
|
{}
|
|
|
|
"#,
|
|
|
|
name, version, extra
|
|
|
|
)
|
|
|
|
}
|
2019-04-05 20:25:08 +00:00
|
|
|
|
2019-06-10 19:38:51 +00:00
|
|
|
#[cargo_test]
|
|
|
|
fn deprecated() {
|
|
|
|
let p = project()
|
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
|
|
|
cargo-features = ["publish-lockfile"]
|
|
|
|
[package]
|
|
|
|
name = "foo"
|
|
|
|
version = "0.1.0"
|
|
|
|
publish-lockfile = true
|
|
|
|
license = "MIT"
|
|
|
|
description = "foo"
|
|
|
|
documentation = "foo"
|
|
|
|
homepage = "foo"
|
|
|
|
repository = "foo"
|
|
|
|
"#,
|
|
|
|
)
|
|
|
|
.file("src/lib.rs", "")
|
|
|
|
.build();
|
|
|
|
p.cargo("package")
|
|
|
|
.masquerade_as_nightly_cargo()
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[PACKAGING] foo v0.1.0 ([..])
|
|
|
|
[VERIFYING] foo v0.1.0 ([..])
|
|
|
|
[WARNING] The `publish-lockfile` feature is deprecated and currently has no effect. \
|
|
|
|
It may be removed in a future version.
|
|
|
|
[COMPILING] foo v0.1.0 ([..])
|
|
|
|
[FINISHED] dev [..]
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-05 20:25:08 +00:00
|
|
|
fn package_lockfile() {
|
|
|
|
let p = project()
|
2019-04-07 21:58:56 +00:00
|
|
|
.file("Cargo.toml", &pl_manifest("foo", "0.0.1", ""))
|
2019-04-05 20:25:08 +00:00
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.build();
|
|
|
|
|
|
|
|
p.cargo("package")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[PACKAGING] foo v0.0.1 ([CWD])
|
|
|
|
[VERIFYING] foo v0.0.1 ([CWD])
|
|
|
|
[COMPILING] foo v0.0.1 ([CWD][..])
|
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
assert!(p.root().join("target/package/foo-0.0.1.crate").is_file());
|
|
|
|
p.cargo("package -l")
|
|
|
|
.with_stdout(
|
|
|
|
"\
|
|
|
|
Cargo.lock
|
|
|
|
Cargo.toml
|
2020-02-19 18:46:54 +00:00
|
|
|
Cargo.toml.orig
|
2019-04-05 20:25:08 +00:00
|
|
|
src/main.rs
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("package").with_stdout("").run();
|
2019-04-05 20:25:08 +00:00
|
|
|
|
|
|
|
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
|
|
|
|
validate_crate_contents(
|
|
|
|
f,
|
|
|
|
"foo-0.0.1.crate",
|
|
|
|
&["Cargo.toml", "Cargo.toml.orig", "Cargo.lock", "src/main.rs"],
|
|
|
|
&[],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-05 20:25:08 +00:00
|
|
|
fn package_lockfile_git_repo() {
|
|
|
|
// Create a Git repository containing a minimal Rust project.
|
2019-04-07 21:58:56 +00:00
|
|
|
let g = git::repo(&paths::root().join("foo"))
|
|
|
|
.file("Cargo.toml", &pl_manifest("foo", "0.0.1", ""))
|
2019-04-05 20:25:08 +00:00
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.build();
|
2019-04-07 21:58:56 +00:00
|
|
|
cargo_process("package -l")
|
|
|
|
.cwd(g.root())
|
2019-04-05 20:25:08 +00:00
|
|
|
.with_stdout(
|
|
|
|
"\
|
|
|
|
.cargo_vcs_info.json
|
|
|
|
Cargo.lock
|
|
|
|
Cargo.toml
|
2020-02-19 18:46:54 +00:00
|
|
|
Cargo.toml.orig
|
2019-04-05 20:25:08 +00:00
|
|
|
src/main.rs
|
2019-04-17 21:06:05 +00:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
cargo_process("package -v")
|
|
|
|
.cwd(g.root())
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[PACKAGING] foo v0.0.1 ([..])
|
|
|
|
[ARCHIVING] .cargo_vcs_info.json
|
|
|
|
[ARCHIVING] Cargo.lock
|
2020-02-19 18:46:54 +00:00
|
|
|
[ARCHIVING] Cargo.toml
|
|
|
|
[ARCHIVING] Cargo.toml.orig
|
|
|
|
[ARCHIVING] src/main.rs
|
2019-04-17 21:06:05 +00:00
|
|
|
[VERIFYING] foo v0.0.1 ([..])
|
|
|
|
[COMPILING] foo v0.0.1 ([..])
|
|
|
|
[RUNNING] `rustc --crate-name foo src/main.rs [..]
|
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
2019-04-05 20:25:08 +00:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-05 20:25:08 +00:00
|
|
|
fn no_lock_file_with_library() {
|
|
|
|
let p = project()
|
2019-04-07 21:58:56 +00:00
|
|
|
.file("Cargo.toml", &pl_manifest("foo", "0.0.1", ""))
|
2019-04-05 20:25:08 +00:00
|
|
|
.file("src/lib.rs", "")
|
|
|
|
.build();
|
|
|
|
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("package").run();
|
2019-04-05 20:25:08 +00:00
|
|
|
|
|
|
|
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
|
|
|
|
validate_crate_contents(
|
|
|
|
f,
|
|
|
|
"foo-0.0.1.crate",
|
|
|
|
&["Cargo.toml", "Cargo.toml.orig", "src/lib.rs"],
|
|
|
|
&[],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-05 20:25:08 +00:00
|
|
|
fn lock_file_and_workspace() {
|
|
|
|
let p = project()
|
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
|
|
|
[workspace]
|
|
|
|
members = ["foo"]
|
|
|
|
"#,
|
|
|
|
)
|
2019-04-07 21:58:56 +00:00
|
|
|
.file("foo/Cargo.toml", &pl_manifest("foo", "0.0.1", ""))
|
2019-04-05 20:25:08 +00:00
|
|
|
.file("foo/src/main.rs", "fn main() {}")
|
|
|
|
.build();
|
|
|
|
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("package").cwd("foo").run();
|
2019-04-05 20:25:08 +00:00
|
|
|
|
|
|
|
let f = File::open(&p.root().join("target/package/foo-0.0.1.crate")).unwrap();
|
|
|
|
validate_crate_contents(
|
|
|
|
f,
|
|
|
|
"foo-0.0.1.crate",
|
|
|
|
&["Cargo.toml", "Cargo.toml.orig", "src/main.rs", "Cargo.lock"],
|
|
|
|
&[],
|
|
|
|
);
|
|
|
|
}
|
2019-04-07 21:58:56 +00:00
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-14 00:33:42 +00:00
|
|
|
fn note_resolve_changes() {
|
2019-04-07 21:58:56 +00:00
|
|
|
// `multi` has multiple sources (path and registry).
|
|
|
|
Package::new("mutli", "0.1.0").publish();
|
|
|
|
// `updated` is always from registry, but should not change.
|
|
|
|
Package::new("updated", "1.0.0").publish();
|
|
|
|
// `patched` is [patch]ed.
|
|
|
|
Package::new("patched", "1.0.0").publish();
|
|
|
|
|
|
|
|
let p = project()
|
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
&pl_manifest(
|
|
|
|
"foo",
|
|
|
|
"0.0.1",
|
|
|
|
r#"
|
|
|
|
[dependencies]
|
|
|
|
mutli = { path = "mutli", version = "0.1" }
|
|
|
|
updated = "1.0"
|
|
|
|
patched = "1.0"
|
|
|
|
|
|
|
|
[patch.crates-io]
|
|
|
|
patched = { path = "patched" }
|
|
|
|
"#,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.file("mutli/Cargo.toml", &basic_manifest("mutli", "0.1.0"))
|
|
|
|
.file("mutli/src/lib.rs", "")
|
|
|
|
.file("patched/Cargo.toml", &basic_manifest("patched", "1.0.0"))
|
|
|
|
.file("patched/src/lib.rs", "")
|
|
|
|
.build();
|
|
|
|
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("generate-lockfile").run();
|
2019-04-07 21:58:56 +00:00
|
|
|
|
|
|
|
// Make sure this does not change or warn.
|
|
|
|
Package::new("updated", "1.0.1").publish();
|
|
|
|
|
2019-04-14 00:33:42 +00:00
|
|
|
p.cargo("package --no-verify -v --allow-dirty")
|
2019-04-07 21:58:56 +00:00
|
|
|
.with_stderr_unordered(
|
|
|
|
"\
|
|
|
|
[PACKAGING] foo v0.0.1 ([..])
|
2020-02-19 18:46:54 +00:00
|
|
|
[ARCHIVING] Cargo.lock
|
2019-04-14 00:33:42 +00:00
|
|
|
[ARCHIVING] Cargo.toml
|
2020-02-19 18:46:54 +00:00
|
|
|
[ARCHIVING] Cargo.toml.orig
|
2019-04-14 00:33:42 +00:00
|
|
|
[ARCHIVING] src/main.rs
|
2019-04-07 21:58:56 +00:00
|
|
|
[UPDATING] `[..]` index
|
2019-04-16 16:06:59 +00:00
|
|
|
[NOTE] package `mutli v0.1.0` added to the packaged Cargo.lock file, was originally sourced from `[..]/foo/mutli`
|
|
|
|
[NOTE] package `patched v1.0.0` added to the packaged Cargo.lock file, was originally sourced from `[..]/foo/patched`
|
2019-04-07 21:58:56 +00:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-07 21:58:56 +00:00
|
|
|
fn outdated_lock_version_change_does_not_warn() {
|
|
|
|
// If the version of the package being packaged changes, but Cargo.lock is
|
|
|
|
// not updated, don't bother warning about it.
|
|
|
|
let p = project()
|
|
|
|
.file("Cargo.toml", &pl_manifest("foo", "0.1.0", ""))
|
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.build();
|
|
|
|
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("generate-lockfile").run();
|
2019-04-07 21:58:56 +00:00
|
|
|
|
|
|
|
p.change_file("Cargo.toml", &pl_manifest("foo", "0.2.0", ""));
|
|
|
|
|
|
|
|
p.cargo("package --no-verify")
|
|
|
|
.with_stderr("[PACKAGING] foo v0.2.0 ([..])")
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-07 21:58:56 +00:00
|
|
|
fn no_warn_workspace_extras() {
|
|
|
|
// Other entries in workspace lock file should be ignored.
|
|
|
|
Package::new("dep1", "1.0.0").publish();
|
|
|
|
Package::new("dep2", "1.0.0").publish();
|
|
|
|
|
|
|
|
let p = project()
|
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
r#"
|
|
|
|
[workspace]
|
|
|
|
members = ["a", "b"]
|
|
|
|
"#,
|
|
|
|
)
|
|
|
|
.file(
|
|
|
|
"a/Cargo.toml",
|
|
|
|
&pl_manifest(
|
|
|
|
"a",
|
|
|
|
"0.1.0",
|
|
|
|
r#"
|
|
|
|
[dependencies]
|
|
|
|
dep1 = "1.0"
|
|
|
|
"#,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.file("a/src/main.rs", "fn main() {}")
|
|
|
|
.file(
|
|
|
|
"b/Cargo.toml",
|
|
|
|
&pl_manifest(
|
|
|
|
"b",
|
|
|
|
"0.1.0",
|
|
|
|
r#"
|
|
|
|
[dependencies]
|
|
|
|
dep2 = "1.0"
|
|
|
|
"#,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.file("b/src/main.rs", "fn main() {}")
|
|
|
|
.build();
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("generate-lockfile").run();
|
2019-04-07 21:58:56 +00:00
|
|
|
p.cargo("package --no-verify")
|
|
|
|
.cwd("a")
|
2019-04-10 02:00:40 +00:00
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[UPDATING] `[..]` index
|
2020-02-19 18:46:54 +00:00
|
|
|
[PACKAGING] a v0.1.0 ([..])
|
2019-04-10 02:00:40 +00:00
|
|
|
",
|
|
|
|
)
|
2019-04-07 21:58:56 +00:00
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-10 02:00:40 +00:00
|
|
|
fn warn_package_with_yanked() {
|
|
|
|
Package::new("bar", "0.1.0").publish();
|
|
|
|
let p = project()
|
|
|
|
.file(
|
|
|
|
"Cargo.toml",
|
|
|
|
&pl_manifest(
|
|
|
|
"foo",
|
|
|
|
"0.0.1",
|
|
|
|
r#"
|
|
|
|
[dependencies]
|
|
|
|
bar = "0.1"
|
|
|
|
"#,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.build();
|
2019-06-10 19:38:51 +00:00
|
|
|
p.cargo("generate-lockfile").run();
|
2019-04-10 02:00:40 +00:00
|
|
|
Package::new("bar", "0.1.0").yanked(true).publish();
|
|
|
|
// Make sure it sticks with the locked (yanked) version.
|
|
|
|
Package::new("bar", "0.1.1").publish();
|
|
|
|
p.cargo("package --no-verify")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[UPDATING] `[..]` index
|
|
|
|
[WARNING] package `bar v0.1.0` in Cargo.lock is yanked in registry \
|
|
|
|
`crates.io`, consider updating to a version that is not yanked
|
2020-02-19 18:46:54 +00:00
|
|
|
[PACKAGING] foo v0.0.1 ([..])
|
2019-04-10 02:00:40 +00:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
2019-06-05 18:52:53 +00:00
|
|
|
#[cargo_test]
|
2019-04-10 02:00:40 +00:00
|
|
|
fn warn_install_with_yanked() {
|
|
|
|
Package::new("bar", "0.1.0").yanked(true).publish();
|
|
|
|
Package::new("bar", "0.1.1").publish();
|
|
|
|
Package::new("foo", "0.1.0")
|
|
|
|
.dep("bar", "0.1")
|
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.file(
|
|
|
|
"Cargo.lock",
|
|
|
|
r#"
|
|
|
|
[[package]]
|
|
|
|
name = "bar"
|
|
|
|
version = "0.1.0"
|
|
|
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
|
|
|
|
|
[[package]]
|
|
|
|
name = "foo"
|
|
|
|
version = "0.1.0"
|
|
|
|
dependencies = [
|
|
|
|
"bar 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
|
|
]
|
|
|
|
"#,
|
|
|
|
)
|
|
|
|
.publish();
|
|
|
|
|
|
|
|
cargo_process("install --locked foo")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[UPDATING] `[..]` index
|
|
|
|
[DOWNLOADING] crates ...
|
|
|
|
[DOWNLOADED] foo v0.1.0 (registry `[..]`)
|
|
|
|
[INSTALLING] foo v0.1.0
|
|
|
|
[WARNING] package `bar v0.1.0` in Cargo.lock is yanked in registry \
|
|
|
|
`crates.io`, consider running without --locked
|
|
|
|
[DOWNLOADING] crates ...
|
|
|
|
[DOWNLOADED] bar v0.1.0 (registry `[..]`)
|
|
|
|
[COMPILING] bar v0.1.0
|
|
|
|
[COMPILING] foo v0.1.0
|
|
|
|
[FINISHED] release [optimized] target(s) in [..]
|
|
|
|
[INSTALLING] [..]/.cargo/bin/foo[EXE]
|
|
|
|
[INSTALLED] package `foo v0.1.0` (executable `foo[EXE]`)
|
|
|
|
[WARNING] be sure to add [..]
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
|
|
|
|
// Try again without --locked, make sure it uses 0.1.1 and does not warn.
|
|
|
|
cargo_process("install --force foo")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[UPDATING] `[..]` index
|
|
|
|
[INSTALLING] foo v0.1.0
|
|
|
|
[DOWNLOADING] crates ...
|
|
|
|
[DOWNLOADED] bar v0.1.1 (registry `[..]`)
|
|
|
|
[COMPILING] bar v0.1.1
|
|
|
|
[COMPILING] foo v0.1.0
|
|
|
|
[FINISHED] release [optimized] target(s) in [..]
|
|
|
|
[REPLACING] [..]/.cargo/bin/foo[EXE]
|
|
|
|
[REPLACED] package `foo v0.1.0` with `foo v0.1.0` (executable `foo[EXE]`)
|
|
|
|
[WARNING] be sure to add [..]
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|
2019-09-26 21:55:59 +00:00
|
|
|
|
|
|
|
#[cargo_test]
|
|
|
|
fn ignore_lockfile() {
|
|
|
|
// With an explicit `include` list, but Cargo.lock in .gitignore, don't
|
|
|
|
// complain about `Cargo.lock` being ignored. Note that it is still
|
|
|
|
// included in the packaged regardless.
|
2020-01-08 18:40:17 +00:00
|
|
|
let p = git::new("foo", |p| {
|
2019-09-26 21:55:59 +00:00
|
|
|
p.file(
|
|
|
|
"Cargo.toml",
|
2020-01-08 18:40:17 +00:00
|
|
|
&pl_manifest(
|
|
|
|
"foo",
|
|
|
|
"0.0.1",
|
|
|
|
r#"
|
2019-09-26 21:55:59 +00:00
|
|
|
include = [
|
|
|
|
"src/main.rs"
|
|
|
|
]
|
2020-01-08 18:40:17 +00:00
|
|
|
"#,
|
|
|
|
),
|
2019-09-26 21:55:59 +00:00
|
|
|
)
|
|
|
|
.file("src/main.rs", "fn main() {}")
|
|
|
|
.file(".gitignore", "Cargo.lock")
|
|
|
|
});
|
|
|
|
p.cargo("package -l")
|
|
|
|
.with_stdout(
|
|
|
|
"\
|
|
|
|
.cargo_vcs_info.json
|
|
|
|
Cargo.lock
|
|
|
|
Cargo.toml
|
2020-02-19 18:46:54 +00:00
|
|
|
Cargo.toml.orig
|
2019-09-26 21:55:59 +00:00
|
|
|
src/main.rs
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
p.cargo("generate-lockfile").run();
|
|
|
|
p.cargo("package -v")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[PACKAGING] foo v0.0.1 ([..])
|
|
|
|
[ARCHIVING] .cargo_vcs_info.json
|
|
|
|
[ARCHIVING] Cargo.lock
|
2020-02-19 18:46:54 +00:00
|
|
|
[ARCHIVING] Cargo.toml
|
|
|
|
[ARCHIVING] Cargo.toml.orig
|
|
|
|
[ARCHIVING] src/main.rs
|
2019-09-26 21:55:59 +00:00
|
|
|
[VERIFYING] foo v0.0.1 ([..])
|
|
|
|
[COMPILING] foo v0.0.1 ([..])
|
|
|
|
[RUNNING] `rustc --crate-name foo src/main.rs [..]
|
|
|
|
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
|
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|
2020-01-08 18:40:17 +00:00
|
|
|
|
|
|
|
#[cargo_test]
|
|
|
|
fn ignore_lockfile_inner() {
|
|
|
|
// Ignore `Cargo.lock` if in .gitignore in a git subdirectory.
|
|
|
|
let p = git::new("foo", |p| {
|
|
|
|
p.no_manifest()
|
|
|
|
.file("bar/Cargo.toml", &pl_manifest("bar", "0.0.1", ""))
|
|
|
|
.file("bar/src/main.rs", "fn main() {}")
|
|
|
|
.file("bar/.gitignore", "Cargo.lock")
|
|
|
|
});
|
|
|
|
p.cargo("generate-lockfile").cwd("bar").run();
|
|
|
|
p.cargo("package -v --no-verify")
|
|
|
|
.cwd("bar")
|
|
|
|
.with_stderr(
|
|
|
|
"\
|
|
|
|
[PACKAGING] bar v0.0.1 ([..])
|
|
|
|
[ARCHIVING] .cargo_vcs_info.json
|
|
|
|
[ARCHIVING] Cargo.lock
|
2020-02-19 18:46:54 +00:00
|
|
|
[ARCHIVING] Cargo.toml
|
|
|
|
[ARCHIVING] Cargo.toml.orig
|
|
|
|
[ARCHIVING] src/main.rs
|
2020-01-08 18:40:17 +00:00
|
|
|
",
|
|
|
|
)
|
|
|
|
.run();
|
|
|
|
}
|