Part of #52. Depends on the shared git-invocation helper sub-issue.
Goal
Add a command to restore working-tree files (ObjectiveGit's Restore-Items),
with -Force and -Source — modernized.
Modernize (do not port as-is)
- ObjectiveGit builds
"git -C $Repository checkout$ExtendedCLI -- $Files" and
runs it via Invoke-Expression — with a [string[]]$Files interpolated into
the command string, this is a real argument-injection/quoting hazard. Use the
shared helper with a git argument array and pass file paths as discrete
arguments after --.
- This is destructive (overwrites working-tree files): add
[CmdletBinding(SupportsShouldProcess)]; honor -WhatIf/-Confirm.
- Consider
git restore (with --source/--staged as appropriate) over raw
checkout -- <paths> for clearer intent.
- Cross-platform path handling; drop the magic exit-code / bug branch.
Acceptance criteria
- Exported from both the
.psm1 and .psd1 export lists.
- Comment-based help;
SupportsShouldProcess honored.
- File paths passed as an argument array (never interpolated into a command
string); final command name uses an approved verb.
- README command table +
[Unreleased] CHANGELOG updated.
- Deterministic Pester tests (temp repo; assert paths with spaces/special chars
are handled and -WhatIf makes no changes).
build/Test-Modules.ps1 and build/Invoke-Tests.ps1 pass.
Part of #52. Depends on the shared git-invocation helper sub-issue.
Goal
Add a command to restore working-tree files (ObjectiveGit's
Restore-Items),with
-Forceand-Source— modernized.Modernize (do not port as-is)
"git -C $Repository checkout$ExtendedCLI -- $Files"andruns it via
Invoke-Expression— with a[string[]]$Filesinterpolated intothe command string, this is a real argument-injection/quoting hazard. Use the
shared helper with a git argument array and pass file paths as discrete
arguments after
--.[CmdletBinding(SupportsShouldProcess)]; honor-WhatIf/-Confirm.git restore(with--source/--stagedas appropriate) over rawcheckout -- <paths>for clearer intent.Acceptance criteria
.psm1and.psd1export lists.SupportsShouldProcesshonored.string); final command name uses an approved verb.
[Unreleased]CHANGELOG updated.are handled and
-WhatIfmakes no changes).build/Test-Modules.ps1andbuild/Invoke-Tests.ps1pass.