Skip to content

Commit 8ce0994

Browse files
committed
cargo: explicitly indicate paths to publish
Running `cargo publish` from a non-colocated repo (such as my usual repo) is currently quite scary because it uploads all non-hidden files, even if they're ignored by `.gitignore` (rust-lang/cargo#2063). I noticed this a while ago and have always run the command from a fresh clone since then. To avoid the need for that, let's use the workaround mentioned on the bug, which is to explicitly list patterns we want to publish.
1 parent 955c9bf commit 8ce0994

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

cli/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ repository = { workspace = true }
1313
documentation = { workspace = true }
1414
keywords = { workspace = true }
1515

16+
include = [
17+
"/LICENSE",
18+
"/build.rs",
19+
"/examples/",
20+
"/src/",
21+
"/testing/",
22+
"/tests/",
23+
"!*.pending-snap",
24+
"!*.snap*",
25+
"/tests/cli-reference@.md.snap"
26+
]
27+
1628
[[bin]]
1729
name = "jj"
1830
path = "src/main.rs"

lib/Cargo.toml

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ repository = { workspace = true }
1212
documentation = { workspace = true }
1313
readme = { workspace = true }
1414

15+
include = [
16+
"/LICENSE",
17+
"/benches/",
18+
"/src/",
19+
"/tests/",
20+
"!*.pending-snap",
21+
"!*.snap*",
22+
]
23+
24+
1525
[[test]]
1626
name = "runner"
1727

lib/proc-macros/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ repository = { workspace = true }
1111
documentation = { workspace = true }
1212
readme = { workspace = true }
1313

14+
include = ["/LICENSE", "/src/"]
15+
1416
[lib]
1517
proc-macro = true
1618

0 commit comments

Comments
 (0)