-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Change how relative paths in Resolve-Path
are handled when using the RelativeBasePath
parameter
#19755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…h parameter of Resolve-Path
Resolve-Path
when using the RelativeBasePath
parameterResolve-Path
when using the RelativeBasePath
parameter
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
test/powershell/Modules/Microsoft.PowerShell.Management/Resolve-Path.Tests.ps1
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't immediately think of a way to solve this without push/pop of the location, but I don't think that's a big deal. Agree we can fix this behavior since it was introduced in a preview.
src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Resolve-Path.Tests.ps1
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Resolve-Path.Tests.ps1
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ResolvePathCommand.cs
Outdated
Show resolved
Hide resolved
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
test/powershell/Modules/Microsoft.PowerShell.Management/Resolve-Path.Tests.ps1
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This change updates the example and documentation for the **RelativeBasePath** parameter of the `Resolve-Path` cmdlet in PowerShell 7.4 to reflect the changes made in PowerShell/PowerShell#19755 affecting the output for the cmdlet when using the parameter. - Fixes AB#149096
This change updates the example and documentation for the **RelativeBasePath** parameter of the `Resolve-Path` cmdlet in PowerShell 7.4 to reflect the changes made in PowerShell/PowerShell#19755 affecting the output for the cmdlet when using the parameter. - Fixes AB#149096
PR Summary
Changes how the
Path
andLiteralPath
parameters treat relative input whenRelativeBasePath
is specified. Previously it would resolve the full path, based on the current directory and then use that to create the relative path. See this demonstration:Now it returns the full, or relative path based off the user specified RelativeBasePath:
The relative output may not seem very useful since it's just outputting what the user wrote, but it shows its use when using wildcards:
This is a breaking change from the current behavior (implemented here: #19358 ) but since it hasn't made its way into a full release yet, it should be fine. This also means this PR should be prioritized to get merged before the next GA release.
Regarding the actual implementation, it feels wrong pushing and popping the location but none of the relevant APIs seemed to support arbitrary paths and it seemed like it would be a lot of work to add it. Maybe someone else has a better suggestion but if not, I hope it's not a blocker.
PR Context
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).