Skip to content

Commit a562387

Browse files
committed
test: Add test for issue-14354
This a test to reflect that `cargo package --allow-dirty` will fail on a bare commit git repo
1 parent fa64658 commit a562387

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/testsuite/package.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,6 +1254,34 @@ fn issue_13695_allowing_dirty_vcs_info_but_clean() {
12541254
);
12551255
}
12561256

1257+
#[cargo_test]
1258+
fn issue_14354_allowing_dirty_bare_commit() {
1259+
let p = project().build();
1260+
// Init a bare commit git repo
1261+
let _ = git::repo(&paths::root().join("foo"))
1262+
.file(
1263+
"Cargo.toml",
1264+
r#"
1265+
[package]
1266+
name = "foo"
1267+
version = "0.1.0"
1268+
edition = "2015"
1269+
description = "foo"
1270+
license = "foo"
1271+
documentation = "foo"
1272+
"#,
1273+
)
1274+
.file("src/lib.rs", "");
1275+
1276+
p.cargo("package --allow-dirty")
1277+
.with_status(101)
1278+
.with_stderr_data(str![[r#"
1279+
[ERROR] revspec 'HEAD' not found; class=Reference (4); code=NotFound (-3)
1280+
1281+
"#]])
1282+
.run();
1283+
}
1284+
12571285
#[cargo_test]
12581286
fn generated_manifest() {
12591287
let registry = registry::alt_init();

0 commit comments

Comments
 (0)