File tree 2 files changed +42
-1
lines changed
src/cargo/ops/cargo_compile
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ fn opt_patterns_and_names(
195
195
let mut opt_patterns = Vec :: new ( ) ;
196
196
let mut opt_names = BTreeSet :: new ( ) ;
197
197
for x in opt. iter ( ) {
198
- if is_glob_pattern ( x) {
198
+ if PackageIdSpec :: parse ( x ) . is_err ( ) && is_glob_pattern ( x) {
199
199
opt_patterns. push ( ( build_glob ( x) ?, false ) ) ;
200
200
} else {
201
201
opt_names. insert ( String :: as_str ( x) ) ;
Original file line number Diff line number Diff line change 3
3
use std:: fmt:: { self , Write } ;
4
4
5
5
use crate :: messages:: raw_rustc_output;
6
+ use cargo_test_support:: compare;
6
7
use cargo_test_support:: install:: exe;
7
8
use cargo_test_support:: paths:: CargoPathExt ;
8
9
use cargo_test_support:: registry:: Package ;
@@ -1519,3 +1520,43 @@ fn versionless_package() {
1519
1520
)
1520
1521
. run ( ) ;
1521
1522
}
1523
+
1524
+ #[ cargo_test]
1525
+ fn pkgid_querystring_works ( ) {
1526
+ let git_project = git:: new ( "gitdep" , |p| {
1527
+ p. file ( "Cargo.toml" , & basic_manifest ( "gitdep" , "1.0.0" ) )
1528
+ . file ( "src/lib.rs" , "" )
1529
+ } ) ;
1530
+ let p = project ( )
1531
+ . file (
1532
+ "Cargo.toml" ,
1533
+ & format ! (
1534
+ r#"
1535
+ [package]
1536
+ name = "foo"
1537
+
1538
+ [dependencies]
1539
+ gitdep = {{ git = "{}", branch = "master" }}
1540
+ "# ,
1541
+ git_project. url( )
1542
+ ) ,
1543
+ )
1544
+ . file ( "src/lib.rs" , "" )
1545
+ . build ( ) ;
1546
+
1547
+ p. cargo ( "generate-lockfile" ) . run ( ) ;
1548
+
1549
+ let output = p. cargo ( "pkgid" ) . arg ( "gitdep" ) . exec_with_output ( ) . unwrap ( ) ;
1550
+ let gitdep_pkgid = String :: from_utf8 ( output. stdout ) . unwrap ( ) ;
1551
+ let gitdep_pkgid = gitdep_pkgid. trim ( ) ;
1552
+ compare:: assert_match_exact ( "git+file://[..]/gitdep?branch=master#1.0.0" , & gitdep_pkgid) ;
1553
+
1554
+ p. cargo ( "build -p" )
1555
+ . arg ( gitdep_pkgid)
1556
+ . with_stderr (
1557
+ "\
1558
+ [COMPILING] gitdep v1.0.0 (file:///[..]/gitdep?branch=master#[..])
1559
+ [FINISHED] dev [..]" ,
1560
+ )
1561
+ . run ( ) ;
1562
+ }
You can’t perform that action at this time.
0 commit comments