@@ -407,6 +407,8 @@ impl<'a> DependencyResolver<'a> {
407407 _ => None ,
408408 } ;
409409
410+ // So if it wasn't already fetched first? then we'll try and resolve it later, and the override
411+ // is not present there for some reason
410412 if !force_override
411413 && ( self . resolutions . contains_key ( name) || self . dependencies . contains_key ( name) )
412414 {
@@ -423,17 +425,29 @@ impl<'a> DependencyResolver<'a> {
423425 ) ;
424426 }
425427 Dependency :: Local ( p) => {
426- // A local path dependency, insert a resolution immediately
427428 let res = DependencyResolution :: Local ( LocalResolution {
428429 name : name. clone ( ) ,
429430 path : p. clone ( ) ,
430431 } ) ;
431432
432- if !force_override && self . resolutions . contains_key ( name) {
433- tracing:: debug!( %name, "dependency already exists and override is not set, ignoring" ) ;
433+ // This is a bit of a hack, but if there are multiple local dependencies that are
434+ // nested and overriden, getting the packages from the local package treats _all_
435+ // deps as registry deps. So if we're handling a local path and the dependencies
436+ // have a registry package already, override it. Otherwise follow normal overrides.
437+ // We should definitely fix this and change where we resolve these things
438+ let should_insert = force_override
439+ || self . dependencies . contains_key ( name)
440+ || !self . resolutions . contains_key ( name) ;
441+ if !should_insert {
442+ tracing:: debug!( %name, "dependency already exists and registry override is not set, ignoring" ) ;
434443 return Ok ( ( ) ) ;
435444 }
436445
446+ // Because we got here, we should remove anything from dependencies that is the same
447+ // package because we're overriding with the local package. Technically we could be
448+ // clever and just do this in the boolean above, but I'm paranoid
449+ self . dependencies . remove ( name) ;
450+
437451 // Now that we check we haven't already inserted this dep, get the packages from the
438452 // local dependency and add those to the resolver before adding the dependency
439453 let ( _, packages) = get_packages ( p)
0 commit comments