|
3 | 3 | use std::fs::{self, read_to_string, File};
|
4 | 4 | use std::path::Path;
|
5 | 5 |
|
6 |
| -use cargo_test_support::compare::assert_e2e; |
7 | 6 | use cargo_test_support::prelude::*;
|
8 | 7 | use cargo_test_support::publish::validate_crate_contents;
|
9 | 8 | use cargo_test_support::registry::{self, Package};
|
@@ -1426,133 +1425,6 @@ edition = "2021"
|
1426 | 1425 | );
|
1427 | 1426 | }
|
1428 | 1427 |
|
1429 |
| -#[cargo_test] |
1430 |
| -fn dirty_ws_lockfile_dirty() { |
1431 |
| - let (p, repo) = git::new_repo("foo", |p| { |
1432 |
| - p.file( |
1433 |
| - "Cargo.toml", |
1434 |
| - r#" |
1435 |
| - [workspace] |
1436 |
| - members = ["isengard"] |
1437 |
| - resolver = "2" |
1438 |
| - [workspace.package] |
1439 |
| - edition = "2015" |
1440 |
| - "#, |
1441 |
| - ) |
1442 |
| - .file( |
1443 |
| - "isengard/Cargo.toml", |
1444 |
| - r#" |
1445 |
| - [package] |
1446 |
| - name = "isengard" |
1447 |
| - edition.workspace = true |
1448 |
| - homepage = "saruman" |
1449 |
| - description = "saruman" |
1450 |
| - license = "MIT" |
1451 |
| - "#, |
1452 |
| - ) |
1453 |
| - .file("isengard/src/lib.rs", "") |
1454 |
| - }); |
1455 |
| - git::commit(&repo); |
1456 |
| - |
1457 |
| - p.cargo("package --workspace --no-verify") |
1458 |
| - .with_stderr_data(str![[r#" |
1459 |
| -[PACKAGING] isengard v0.0.0 ([ROOT]/foo/isengard) |
1460 |
| -[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) |
1461 |
| -
|
1462 |
| -"#]]) |
1463 |
| - .run(); |
1464 |
| - |
1465 |
| - // lockfile is untracked. |
1466 |
| - p.cargo("generate-lockfile").run(); |
1467 |
| - p.cargo("package --workspace --no-verify") |
1468 |
| - .with_status(101) |
1469 |
| - .with_stderr_data(str![[r#" |
1470 |
| -[ERROR] 1 files in the working directory contain changes that were not yet committed into git: |
1471 |
| -
|
1472 |
| -Cargo.lock |
1473 |
| -
|
1474 |
| -to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag |
1475 |
| -
|
1476 |
| -"#]]) |
1477 |
| - .run(); |
1478 |
| - |
1479 |
| - // lockfile is tracked. |
1480 |
| - p.cargo("clean").run(); |
1481 |
| - git::add(&repo); |
1482 |
| - git::commit(&repo); |
1483 |
| - p.cargo("package --workspace --no-verify") |
1484 |
| - .with_stderr_data(str![[r#" |
1485 |
| -[PACKAGING] isengard v0.0.0 ([ROOT]/foo/isengard) |
1486 |
| -[PACKAGED] 5 files, [FILE_SIZE]B ([FILE_SIZE]B compressed) |
1487 |
| -
|
1488 |
| -"#]]) |
1489 |
| - .run(); |
1490 |
| - |
1491 |
| - // Simulate that Cargo.lock had some outdated but SemVer compat dependency changes. |
1492 |
| - Package::new("dep", "1.0.0").publish(); |
1493 |
| - Package::new("dep", "1.1.0").publish(); |
1494 |
| - p.cargo("clean").run(); |
1495 |
| - p.cargo("add dep@1").run(); |
1496 |
| - git::add(&repo); |
1497 |
| - git::commit(&repo); |
1498 |
| - // make sure we have [email protected] in lockfile |
1499 |
| - assert_e2e().eq( |
1500 |
| - &p.read_lockfile(), |
1501 |
| - str![[r##" |
1502 |
| -# This file is automatically @generated by Cargo. |
1503 |
| -# It is not intended for manual editing. |
1504 |
| -version = 4 |
1505 |
| -
|
1506 |
| -[[package]] |
1507 |
| -name = "dep" |
1508 |
| -version = "1.1.0" |
1509 |
| -source = "registry+https://github.com/rust-lang/crates.io-index" |
1510 |
| -checksum = "77d3d6a4f2203d590707cc803c94afbe36393bbdba757ef66986f39159eaab51" |
1511 |
| -
|
1512 |
| -[[package]] |
1513 |
| -name = "isengard" |
1514 |
| -version = "0.0.0" |
1515 |
| -dependencies = [ |
1516 |
| - "dep", |
1517 |
| -] |
1518 |
| -
|
1519 |
| -"##]], |
1520 |
| - ); |
1521 |
| - p.cargo("update dep --precise 1.0.0") |
1522 |
| - .with_stderr_data(str![[r#" |
1523 |
| -[UPDATING] `dummy-registry` index |
1524 |
| -[DOWNGRADING] dep v1.1.0 -> v1.0.0 |
1525 |
| -
|
1526 |
| -"#]]) |
1527 |
| - .run(); |
1528 |
| - p.cargo("package --workspace --no-verify") |
1529 |
| - .with_status(101) |
1530 |
| - .with_stderr_data(str![[r#" |
1531 |
| -[ERROR] 1 files in the working directory contain changes that were not yet committed into git: |
1532 |
| -
|
1533 |
| -Cargo.lock |
1534 |
| -
|
1535 |
| -to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag |
1536 |
| -
|
1537 |
| -"#]]) |
1538 |
| - .run(); |
1539 |
| - |
1540 |
| - // Now check if it is considered dirty when removed. |
1541 |
| - p.cargo("clean").run(); |
1542 |
| - fs::remove_file(p.root().join("Cargo.lock")).unwrap(); |
1543 |
| - p.cargo("package --workspace --no-verify") |
1544 |
| - .with_status(101) |
1545 |
| - .with_stderr_data(str![[r#" |
1546 |
| -[ERROR] 1 files in the working directory contain changes that were not yet committed into git: |
1547 |
| -
|
1548 |
| -Cargo.lock |
1549 |
| -
|
1550 |
| -to proceed despite this and include the uncommitted changes, pass the `--allow-dirty` flag |
1551 |
| -
|
1552 |
| -"#]]) |
1553 |
| - .run(); |
1554 |
| -} |
1555 |
| - |
1556 | 1428 | #[cargo_test]
|
1557 | 1429 | fn issue_13695_allow_dirty_vcs_info() {
|
1558 | 1430 | let p = project()
|
|
0 commit comments