Skip to content

Commit 929a656

Browse files
committed
remove duplicate property reads
1 parent a1066ff commit 929a656

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/NuGet.Core/NuGet.Commands/RestoreCommand/Utility/PackageSpecFactory.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ private static bool ProjectHasPackagesConfigFile(string projectDirectory, string
412412
internal static string GetPackagesPath(IProject project, ISettings settings)
413413
{
414414
var packagesPath = GetValue(
415-
() => UriUtility.GetAbsolutePath(project.Directory, project.OuterBuild.GetProperty(ProjectBuildProperties.RestorePackagesPath)),
416415
() => UriUtility.GetAbsolutePath(project.Directory, project.OuterBuild.GetProperty(ProjectBuildProperties.RestorePackagesPath)),
417416
() => SettingsUtility.GetGlobalPackagesFolder(settings));
418417

@@ -743,7 +742,6 @@ private static LibraryIncludeFlags GetLibraryIncludeFlags(string value, LibraryI
743742
private static string GetRepositoryPath(IProject project, ISettings settings)
744743
{
745744
var path = GetValue(
746-
() => UriUtility.GetAbsolutePath(project.Directory, project.OuterBuild.GetProperty(ProjectBuildProperties.RestoreRepositoryPath)),
747745
() => UriUtility.GetAbsolutePath(project.Directory, project.OuterBuild.GetProperty(ProjectBuildProperties.RestoreRepositoryPath)),
748746
() => SettingsUtility.GetRepositoryPath(settings),
749747
() =>
@@ -795,18 +793,16 @@ internal static List<PackageSource> GetSources(IProject project, ISettings setti
795793
project.OuterBuild.GetProperty("OriginalMSBuildStartupDirectory"),
796794
project.Directory,
797795
project.OuterBuild.SplitPropertyValueOrNull(ProjectBuildProperties.RestoreSources),
798-
project.OuterBuild.SplitPropertyValueOrNull(ProjectBuildProperties.RestoreSources),
799796
project.TargetFrameworks.Values.SelectMany(i => MSBuildStringUtility.Split(i.GetProperty(ProjectBuildProperties.RestoreAdditionalProjectSources))),
800797
settings)
801798
.Select(i => new PackageSource(i))
802799
.ToList();
803800
}
804801

805-
private static string[] GetSources(string startupDirectory, string projectDirectory, string[]? sources, string[]? sourcesOverride, IEnumerable<string> additionalProjectSources, ISettings settings)
802+
private static string[] GetSources(string startupDirectory, string projectDirectory, string[]? sources, IEnumerable<string> additionalProjectSources, ISettings settings)
806803
{
807804
// Sources
808805
var currentSources = GetValue(
809-
() => sourcesOverride?.Select(MSBuildRestoreUtility.FixSourcePath).Select(e => UriUtility.GetAbsolutePath(startupDirectory, e)).ToArray(),
810806
() => MSBuildRestoreUtility.ContainsClearKeyword(sources) ? Array.Empty<string>() : null,
811807
() => sources?.Select(MSBuildRestoreUtility.FixSourcePath).Select(e => UriUtility.GetAbsolutePath(projectDirectory, e)).ToArray(),
812808
() => (PackageSourceProvider.LoadPackageSources(settings)).Where(e => e.IsEnabled).Select(e => e.Source).ToArray());

0 commit comments

Comments
 (0)