diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index db33081cde..66c4cca21f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 0.11.0-alpha004 - 29.10.2014 +* Paket no longer leaves indirect dependencies in lockfile after remove command - https://github.com/fsprojects/Paket/pull/306 + #### 0.11.0-alpha003 - 29.10.2014 * BUGFIX: ALlow spaces ib quoted parameter parsing - https://github.com/fsprojects/Paket/pull/311 diff --git a/src/Paket.Core/UpdateProcess.fs b/src/Paket.Core/UpdateProcess.fs index 34eaf1459b..a2097c3fa3 100644 --- a/src/Paket.Core/UpdateProcess.fs +++ b/src/Paket.Core/UpdateProcess.fs @@ -38,16 +38,17 @@ let updateWithModifiedDependenciesFile(dependenciesFile:DependenciesFile,package lockFile else let oldLockFile = LockFile.LoadFrom(lockFileName.FullName) - + let packageKeys = dependenciesFile.DirectDependencies |> Seq.map (fun kv -> kv.Key.ToLower()) |> Set.ofSeq + let updatedDependenciesFile = oldLockFile.ResolvedPackages |> Seq.fold (fun (dependenciesFile : DependenciesFile) kv -> - let resolvedPackage = kv.Value - if resolvedPackage.Name.ToLower() = package.ToLower() then dependenciesFile - else - dependenciesFile.AddFixedPackage - (resolvedPackage.Name, "== " + resolvedPackage.Version.ToString())) dependenciesFile + let resolvedPackage = kv.Value + let name = resolvedPackage.Name.ToLower() + if name = package.ToLower() || not <| packageKeys.Contains name then dependenciesFile else + dependenciesFile.AddFixedPackage(resolvedPackage.Name, "== " + resolvedPackage.Version.ToString())) + dependenciesFile let resolution = updatedDependenciesFile.Resolve(force) let resolvedPackages = resolution.ResolvedPackages.GetModelOrFail()