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
Fix -OlderThan
/-NewerThan
parameters for Test-Path
when using PathType
and date range
#20942
Fix -OlderThan
/-NewerThan
parameters for Test-Path
when using PathType
and date range
#20942
Conversation
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) |
The GitHub search results shows that users don't use this both parameters simultaneously. So the change is in grace area and only formally breaking change. |
@ArmaanMcleod Please open doc issue - I think we need to add more informative examples for these parameters. |
@iSazonov Thanks for confirming current usage using both parameters together and container bug 🙂. I have also opened up docs issue to document parameter usage. |
@PowerShell/wg-powershell-cmdlets reviewed this, we agree that the change to |
📣 Hey @ArmaanMcleod, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
…PathType` and date range (PowerShell#20942)
…PathType` and date range (PowerShell#20942)
PR Summary
Fixes #19855
Fixes #19462
Fix
-OlderThan
/-NewerThan
dynamic parameters forTest-Path
when usingPathType
and date range.PR Context
Made the following changes to improve experience using date parameters:
this.PathType == TestPathType.Any
check fromGetDynamicParameters
method so-OlderThan
/-NewerThan
can be used with any path type.-OlderThan
/-NewerThan
last write time inItemExists
method to do a logical AND so it checks path existence within a time range instead ofNewerThan
overwritingOlderThan
if they are both used. This change is probably considered a bucket 3 breaking change since its highly unlikely anyone relied in previous broken behaviour.Test-Path
to runItemExists
on directories as well so they can be checked with-OlderThan
/-NewerThan
parameters, since before it only checkedIsItemContainer
, which didn't run the dynamic parameter date checks.-OlderThan
/-NewerThan
parameters since there was no code coverage for this functonality before this PR. Included multiple combinations of path types against files & directories.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.-OlderThan
/-NewerThan
parameter updates forTest-Path
cmdlet MicrosoftDocs/PowerShell-Docs#10742(which runs in a different PS Host).