mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
fix(--package
): accept ?
if it's a valid pkgid spec
Previously if a value from `--package` flag contains `?`, Cargo considered it as a glob pattern. However, staring from 12933 the Package Id Spec has been extended to accept `?` for git sources. This PR adjust accordingly to accept `?` from `--package` flag when it is a valid Package Id Spec.
This commit is contained in:
parent
a37d122949
commit
637b5d1eae
@ -195,7 +195,7 @@ fn opt_patterns_and_names(
|
|||||||
let mut opt_patterns = Vec::new();
|
let mut opt_patterns = Vec::new();
|
||||||
let mut opt_names = BTreeSet::new();
|
let mut opt_names = BTreeSet::new();
|
||||||
for x in opt.iter() {
|
for x in opt.iter() {
|
||||||
if is_glob_pattern(x) {
|
if PackageIdSpec::parse(x).is_err() && is_glob_pattern(x) {
|
||||||
opt_patterns.push((build_glob(x)?, false));
|
opt_patterns.push((build_glob(x)?, false));
|
||||||
} else {
|
} else {
|
||||||
opt_names.insert(String::as_str(x));
|
opt_names.insert(String::as_str(x));
|
||||||
|
@ -1553,7 +1553,10 @@ fn pkgid_querystring_works() {
|
|||||||
|
|
||||||
p.cargo("build -p")
|
p.cargo("build -p")
|
||||||
.arg(gitdep_pkgid)
|
.arg(gitdep_pkgid)
|
||||||
.with_status(101)
|
.with_stderr(
|
||||||
.with_stderr("[ERROR] package pattern(s) `git+file:///[..]/gitdep?branch=master#1.0.0` not found in workspace `[CWD]`")
|
"\
|
||||||
|
[COMPILING] gitdep v1.0.0 (file:///[..]/gitdep?branch=master#[..])
|
||||||
|
[FINISHED] dev [..]",
|
||||||
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user