cargo publish 不会忽略 .gitignore 中的文件

cargo publish is not ignoring files in .gitignore

» cargo publish
    Updating crates.io index
warning: manifest has no license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
error: 1 files in the working directory contain changes that were not yet committed into git:

rusttermpose.sublime-workspace

每次推送更改时提交此文件或删除它都是糟糕的选择。它列在 ./.gitignore 中,但 cargo 似乎并不关心。我相当确定 cargo 应该关心,而且从历史上看,有,但这将是一个奇怪的错误,所以我想我应该在报告之前询问我是否遗漏了什么。

该项目位于更大的 git 存储库内的子目录 (/rust/) 中。

/rust/.git忽略,和/.git忽略说

/rust/rusttermpose.sublime-workspace
rusttermpose.sublime-workspace
/rusttermpose.sublime-workspace
*.sublime-workspace

rusttermpose.sublime-工作区不在git的跟踪文件中

» git ls-files
Cargo.toml
README.md
examples/simple.rs
longterm.term
rusttermpose.sublime-project
sexp tests.sexp
shortterm.term
shortwood.sexp
src/lib.rs
src/parsers/mod.rs
src/parsers/termpose_parser.rs
src/parsers/woodslist_parser.rs
src/wooder.rs
tests.term
wood_derive/Cargo.toml
wood_derive/src/lib.rs

如果我理解你的问题是正确的,你可以这样说:

# Workspace files
*.sublime-workspace

它将忽略 all 扩展名为 .sublime-workspace 的文件。

您还可以这样做:

/rusttermpose.sublime-workspace

但不是:

./rusttermpose.sublime-workspace

即做相对于你的根。

你也可以这样做(忽略子目录中的文件):

**/*.sublime-workspace

或(包括当前目录)

**.sublime-workspace

如果您不确定确切的目录结构。

是的,这是一个错误。自/10/18

以来一直在那里

它只会影响 git 项目子目录中的板条箱。

https://github.com/rust-lang/cargo/issues/6188