Skip to content

Add WorkingCopy::merge() to support git merge - #248

Merged
lyrixx merged 2 commits into
mainfrom
worktree-issue-118-merge-command
Sep 7, 2026
Merged

Add WorkingCopy::merge() to support git merge#248
lyrixx merged 2 commits into
mainfrom
worktree-issue-118-merge-command

Conversation

@lyrixx

@lyrixx lyrixx commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a merge() method on WorkingCopy, mirroring the existing checkout() method: it accepts a Commit, Reference, or string revision, plus an optional array of extra CLI arguments (e.g. ['--no-ff']).
  • Documents the new method in doc/workingcopy.md.
  • Closes Missing merge command #118.

Test plan

  • Added testMerge (clean merge produces a 2-parent merge commit) and testMergeConflict (conflicting merge throws RuntimeException) to WorkingCopyTest.
  • vendor/bin/phpunit — 226 tests, 565 assertions, all green.
  • castor cs --dry-run — no issues.
  • castor phpstan — no errors.

Mirrors the existing checkout() method: accepts a Commit, Reference or
string revision, plus optional extra CLI args (e.g. ['--no-ff']).
CI runners have no global git user.name/email, so the merge commit
creation failed with "Committer identity unknown". Set a local
identity on the test repository first, matching the pattern already
used in ReferenceTest and LogTest for commit-creating tests.
@lyrixx
lyrixx merged commit d7b9315 into main Sep 7, 2026
6 checks passed
@lyrixx
lyrixx deleted the worktree-issue-118-merge-command branch September 7, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Missing merge command

1 participant