From 0f67340c676280827f09c5a6d3ebe7bfc06f43cc Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 6 Jul 2017 08:33:51 -0700 Subject: [PATCH 1/2] Respect the env variable NUGET_PACKAGES The environment variable `%NUGET_PACKAGES%` can be used to specify a location where NuGet packages should restore. This is respected during the restore of this repo. Yet the build file GitLink.NuGet.nuproj assumes packages will always be restored to `%USERPROFILE%\.nuget\packages`. Fix is to respect `%NUGET_PACKAGES%` in GitLink.NuGet.nuproj closes #162 --- src/GitLink.NuGet/GitLink.NuGet.nuproj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/GitLink.NuGet/GitLink.NuGet.nuproj b/src/GitLink.NuGet/GitLink.NuGet.nuproj index e292dc4..338674f 100644 --- a/src/GitLink.NuGet/GitLink.NuGet.nuproj +++ b/src/GitLink.NuGet/GitLink.NuGet.nuproj @@ -14,7 +14,9 @@ 29e78909-b7fb-472c-a9a0-1749a8be9a9a - $(UserProfile)\.nuget\packages\NuProj\0.11.14-beta\tools + <_NuGetRoot>$(UserProfile)\.nuget\packages + <_NuGetRoot Condition="'$(NUGET_PACKAGES)' != ''">$(NUGET_PACKAGES) + $(_NuGetRoot)\NuProj\0.11.14-beta\tools @@ -47,4 +49,4 @@ - \ No newline at end of file + From 26fb807b7d12556a7837dd34278eeda30bf6734e Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 6 Jul 2017 08:37:25 -0700 Subject: [PATCH 2/2] Handle files with a backtick in the name GitLink uses the `Uri` APIs in order to calculate relative file paths. This API will escape a number of characters, including backtick, when converting from `string` to `Uri`. These characters are not unescaped when converting from `Uri` to `string`. Hence the paths produced from GetRelativePath are incorrect and GitLink can't process the files. Fixed to unescape the characters once the relative path is calculated. closes #163 --- src/GitLink/Extensions/RepositoryExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitLink/Extensions/RepositoryExtensions.cs b/src/GitLink/Extensions/RepositoryExtensions.cs index b6d58c8..22db728 100644 --- a/src/GitLink/Extensions/RepositoryExtensions.cs +++ b/src/GitLink/Extensions/RepositoryExtensions.cs @@ -74,7 +74,7 @@ private static string GetRelativePath(string target, string relativeTo) Uri baseUri = new Uri(relativeTo, UriKind.Absolute); Uri targetUri = new Uri(target, UriKind.Absolute); - return baseUri.MakeRelativeUri(targetUri).ToString(); + return Uri.UnescapeDataString(baseUri.MakeRelativeUri(targetUri).ToString()); } } }