-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Make Move-Item work with its -Include, -Exclude, and -Filter parameters #3878
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
…rs (#2385) Invoke the correct overload of SessionState.Path.GetResolvedPSPathFromPSPath, passing the cmdlet context object.
|
@iSazonov Can you take a look at the Appveyor failure? I'm looking at the details and they seem to show two failure points, neither of which have anything to do with this PR. |
|
@jeffbi I see the same in other PRs. Nightly builds is affected too. |
iSazonov
left a comment
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.
Original Issue say that the cmdlet works well but writes unexpected error message - I don't see the check in tests.
|
@iSazonov Well, what it actually said what that the cmdlet successfully performed the action that was intended, then wrote an error. That's not quite the same as it worked well. I've updated the tests to check that the |
|
LGTM. |
| $booContent = "boo content" | ||
| } | ||
| BeforeEach { | ||
| New-Item -ItemType Directory -Path $filterPath |
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.
Should be
New-Item -ItemType Directory -Path $filterPath | Out-Nullto avoid on console output of created item
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.
Fixed.
| It "Can move to different directory, filtered with -Include" { | ||
| Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" | ||
| $? | Should Be $true | ||
| Test-Path -Path $barPath | Should Be $false |
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.
Use Powershell $barPath | Should Not Exist"
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.
Fixed
| } | ||
| It "Can move to different directory, filtered with -Include" { | ||
| Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" | ||
| $? | Should Be $true |
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.
Difficult to debug from logs. Instead use
Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" -ErrorVariable e -ErrorAction SilentlyContinue
$e | Should BeNullOrEmptyThere 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.
Fixed
| It "Can move to different directory, filtered with -Include" { | ||
| Move-Item -Path $filePath -Destination $moveToPath -Include "bar*" -ErrorVariable e -ErrorAction SilentlyContinue | ||
| $e | Should BeNullOrEmpty | ||
| #Test-Path -Path $barPath | Should Be $false |
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.
Please remove the comment.
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.
Thanks for catching that. Fixed.
|
@jeffbi Thanks for the fix! LGTM. (After removing one unneeded comment) |
|
@iSazonov, @adityapatwardhan Thanks for the review. |
|
@jeffbi Can you update or remove the company in your profile? If it is accurate, please email me internally about additional steps you need to take. @adityapatwardhan Please make your Microsoft Organization membership public. |
Fixed #2385
Invoke the correct overload of SessionState.Path.GetResolvedPSPathFromPSPath, passing the cmdlet context object.