Skip to content

Add Path targeting to Git helpers - #108

Merged
shmuelie merged 2 commits into
mainfrom
shmuelie/issue-27-git-path-parameter
Aug 21, 2026
Merged

Add Path targeting to Git helpers#108
shmuelie merged 2 commits into
mainfrom
shmuelie/issue-27-git-path-parameter

Conversation

@shmuelie

@shmuelie shmuelie commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Adds a consistent optional repository -Path context to Git helpers so callers can target another working tree without changing their current location.

Final combined behavior:

  • Routes explicit repository-path Git operations through git -C <path>.
  • Preserves existing current-directory behavior when repository -Path is omitted.
  • Keeps main's -WorktreePath destination parameter on New-Worktree and Add-Worktree; these commands now support both source -Path and destination -WorktreePath.
  • Keeps main's Remove-Worktree and Set-Worktree -Path semantics as target worktree paths, not repository contexts, because the target path fully identifies the worktree.
  • Keeps main's Update-Worktrees InProgress handling and Operation result field while adding repository -Path targeting.
  • Validates explicit repository paths with clear errors for non-git directories.
  • Adds Pester coverage for default behavior, explicit paths, pipeline Path input, invalid paths, -WorktreePath coexistence, and in-progress update handling.

Validation:

  • ./build/Test-Modules.ps1
  • ./build/Invoke-Tests.ps1 -Path tests/Shmuelie.Git.Tests.ps1
  • ./build/Invoke-Tests.ps1

Closes #27

Thread a consistent -Path repository context through status, worktree, sync, stale branch, and update helpers so callers can operate on another repository without changing their location.

Route git calls through git -C for explicit paths and validate non-git paths with clear errors while preserving existing current-directory behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b98f01a0-a039-492f-8576-b1917e54742d
…-path-parameter

# Conflicts:
#	modules/Shmuelie.Git/CHANGELOG.md
#	modules/Shmuelie.Git/Public/Update-Worktrees.ps1
#	modules/Shmuelie.Git/Public/Worktrees.ps1
#	modules/Shmuelie.Git/README.md
#	tests/Shmuelie.Git.Tests.ps1
@shmuelie
shmuelie merged commit 35c0ee5 into main Aug 21, 2026
1 check passed
@shmuelie
shmuelie deleted the shmuelie/issue-27-git-path-parameter branch August 21, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git helpers: add optional parameter to target a specific repository instead of only the current directory

1 participant