FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(git): replay stacks on older Git versions by kitlangton · Pull Request #47 · kitlangton/stack · GitHub

fix(git): replay stacks on older Git versions - #47

Merged
kitlangton merged 1 commit into
mainfrom
fix/older-git-replay
Aug 28, 2026
Merged

fix(git): replay stacks on older Git versions#47
kitlangton merged 1 commit into
mainfrom
fix/older-git-replay

Conversation

Copy link
Copy Markdown
Owner

Why

stack sync --apply cannot repair branches on Git 2.39 because replay passes cherry-pick --empty=drop, an option that Git does not support until 2.45. Git exits at argument parsing, so even a conflict-free replay fails.

What Changes

Replay input Result
Ordinary commits on older Git Replay in order without the unsupported option
A commit's changes are already on the new parent Skip it and continue with later commits
A commit was empty when originally created Stop, preserving the existing behavior
Conflict or failed commit hook Stop and preserve the original branch tip
Conflict in a linked worktree Report paths from that worktree rather than the CLI's working directory

Empty-pick detection uses Git state, not localized stderr: exit code 1, no unmerged paths, the expected CHERRY_PICK_HEAD, a clean tracked tree, and an originally nonempty commit. Failed state inspection does not authorize a skip. Replay disables rerere's automatic index updates so a remembered conflict resolution cannot masquerade as an empty pick. Existing replay cleanup restores the current branch and removes temporary replay refs on success or failure.

Scope

Independent implementation of the compatibility problem reported in #40, with a patch changeset. No new configuration or changes to readiness policy. Sequential replay adds a Git process per commit; additional inspection runs only after a failed pick.

Verification

GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null bun run test
bun run typecheck
bun run format:check
bun run lint
bun run package:smoke
bun run changeset:status --since origin/main
bun src/cli.ts --help
bun src/cli.ts sync --help
git diff --check

All 169 tests pass with both a locally built Git 2.39.5 and Apple Git 2.50.1 on PATH. The unmodified 0.4.3 source fails its existing clean-worktree replay test with Git 2.39.5's cherry-pick usage error.

Six new real-repository regressions cover a redundant middle commit with opaque error text, originally empty commits, owning-worktree conflicts, commit-hook failure, failed skip cleanup, and a remembered rerere resolution. A process adapter rejects --empty=drop so the compatibility regression remains effective on newer CI installations.

Replace the unsupported cherry-pick --empty=drop flag with sequential replay and state-based redundant-pick detection. Preserve initially empty commit failures and prevent rerere autoupdate from hiding conflicts.

Read conflicts from the owning worktree and cover compatibility, hook failures, skip cleanup, and remembered resolutions with real-Git regressions.
kitlangton merged commit 0ee9a92 into main Aug 28, 2026
1 check passed
kitlangton deleted the fix/older-git-replay branch August 28, 2026 02:30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

1 participant


Back | FazBrowse Home | New Git URL