@@ -379,4 +379,108 @@ void main() {
379379 });
380380 },
381381 );
382+
383+ test (
384+ 'multiple path dependencies to same package work (regression https://github.com/dart-lang/pub/issues/4706)' ,
385+ () async {
386+ await d.git ('foo.git' , [
387+ d.dir ('one' , [
388+ d.libPubspec (
389+ 'one' ,
390+ '1.0.0' ,
391+ sdk: '^3.9.0' ,
392+ deps: {
393+ 'two' : {'path' : '../two' },
394+ 'three' : {'path' : '../three' },
395+ },
396+ ),
397+ ]),
398+ d.dir ('two' , [
399+ d.libPubspec (
400+ 'two' ,
401+ '1.0.0' ,
402+ sdk: '^3.9.0' ,
403+ deps: {
404+ 'three' : {'path' : '../three' },
405+ },
406+ ),
407+ ]),
408+ d.dir ('three' , [d.libPubspec ('three' , '1.0.0' , sdk: '^3.9.0' )]),
409+ ]).create ();
410+ final g = d.git ('foo.git' , []);
411+ await g.tag ('1.0.0' );
412+ final ref = await g.revParse ('HEAD' );
413+
414+ await d
415+ .appDir (
416+ dependencies: {
417+ 'one' : {
418+ 'git' : {
419+ 'url' : '../foo.git' ,
420+ 'path' : 'one' ,
421+ 'tag_pattern' : '{{version}}' ,
422+ },
423+ 'version' : '^1.0.0' ,
424+ },
425+ },
426+ pubspec: {
427+ 'environment' : {'sdk' : '^3.9.0' },
428+ },
429+ )
430+ .create ();
431+
432+ await pubGet (
433+ output: allOf (
434+ contains ('+ one 1.0.0' ),
435+ contains ('+ two 1.0.0' ),
436+ contains ('+ three 1.0.0' ),
437+ ),
438+ environment: {'_PUB_TEST_SDK_VERSION' : '3.9.0' },
439+ );
440+ final lockfile =
441+ loadYaml (
442+ File (
443+ p.join (d.sandbox, appPath, 'pubspec.lock' ),
444+ ).readAsStringSync (),
445+ )
446+ as Map ;
447+ final packages = lockfile['packages' ] as Map ;
448+ final one = packages['one' ];
449+ expect (one, {
450+ 'dependency' : 'direct main' ,
451+ 'description' : {
452+ 'path' : 'one' ,
453+ 'resolved-ref' : ref,
454+ 'tag-pattern' : '{{version}}' ,
455+ 'url' : '../foo.git' ,
456+ },
457+ 'source' : 'git' ,
458+ 'version' : '1.0.0' ,
459+ });
460+ final two = packages['two' ];
461+ expect (two, {
462+ 'dependency' : 'transitive' ,
463+ 'description' : {
464+ 'path' : 'two' ,
465+ 'ref' : ref,
466+ 'resolved-ref' : ref,
467+ 'url' : '../foo.git' ,
468+ },
469+ 'source' : 'git' ,
470+ 'version' : '1.0.0' ,
471+ });
472+ final three = packages['three' ];
473+ expect (three, {
474+ 'dependency' : 'transitive' ,
475+ 'description' : {
476+ 'path' : 'three' ,
477+ 'ref' : ref,
478+ 'resolved-ref' : ref,
479+ 'url' : '../foo.git' ,
480+ },
481+ 'source' : 'git' ,
482+ 'version' : '1.0.0' ,
483+ });
484+ },
485+ );
382486}
0 commit comments