You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using cargo init or cargo new with --vcs hg, a .hgignore file is generated with the following content:
/target/
**/*.rs.bk
Cargo.lock
Mercurial supports two different syntaxes for ignoring files: regexp and glob. You can have different sections of the file that use either syntax, by declaring a line syntax: glob or syntax: regexp. An alternative is to prefix specific lines with glob: or regexp:. If no syntax is specified, it defaults to regexp.
The problem is that the .hgignore generated by cargo uses the glob syntax, but does not declare syntax: glob so Mercurial tries to interpret it as regexps, giving an error.
C:\Users\me\source\myproject>hg status
abort: C:\Users\me\source\myproject\.hgignore: invalid pattern (relre): **/*.rs.bk
The correct content should be:
^target/
\.rs\.bk$
^Cargo.lock$
^target/ matches only the top-level directory "target"
\.rs\.bk$ matches all files ending with .rs.bk (patterns are not rooted, so this actually matches files in any directory)
^Cargo.lock$ matches exactly the file "Cargo.lock"
The text was updated successfully, but these errors were encountered:
let hgignore = ["^target/\n","glob:*.rs.bk\n",if !opts.bin{"glob:Cargo.lock\n"}else{""}].concat();
For some reason, I end up with the content of the variable ignore instead of this hgignore. Also note that glob:Cargo.lock matches a "Cargo.lock" file in any directory, not only the root.
I was using stable and also a relatively recent nightly. I just updated to a more recent nightly that indeed contains the fix. Sorry about that, I'm closing this issue.
When using
cargo init
orcargo new
with--vcs hg
, a.hgignore
file is generated with the following content:Mercurial supports two different syntaxes for ignoring files: regexp and glob. You can have different sections of the file that use either syntax, by declaring a line
syntax: glob
orsyntax: regexp
. An alternative is to prefix specific lines withglob:
orregexp:
. If no syntax is specified, it defaults to regexp.The problem is that the
.hgignore
generated by cargo uses the glob syntax, but does not declaresyntax: glob
so Mercurial tries to interpret it as regexps, giving an error.The correct content should be:
^target/
matches only the top-level directory "target"\.rs\.bk$
matches all files ending with .rs.bk (patterns are not rooted, so this actually matches files in any directory)^Cargo.lock$
matches exactly the file "Cargo.lock"The text was updated successfully, but these errors were encountered: