fix(sync): stay on default branch after sync#56
Merged
rios0rios0 merged 3 commits intomainfrom Apr 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates DevForge’s repo sync finalization so that, after a successful dev repo sync, repositories end on their default branch (not the originally-checked-out branch), preventing subsequent operations like dev repo prune from failing due to a non-default worktree branch being in use.
Changes:
- Change
RestoreAfterSyncto checkoutdefaultBranchafter syncing (including after WIP handling for dirty repos). - Remove the “restore original branch when clean” behavior.
- Update sync unit tests to match the new final-checkout expectations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/repo/sync.go | Adjusts post-sync checkout behavior to leave repos on the default branch. |
| internal/repo/sync_test.go | Updates/extends assertions to reflect the new post-sync branch state. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
- changed `RestoreAfterSync` to checkout the default branch instead of the original branch after rebasing the WIP branch - removed the `else if` block that checked out the original branch for clean repos on non-default branches (already on default from the sync step) - this prevents `prune` from failing with "cannot delete branch used by worktree" when the merged branch is currently checked out Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fedfb15 to
e20c2c0
Compare
…rSync` and added changelog entry Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- renamed `RestoreAfterSync` to `FinalizeSync` and updated doc comment - handled checkout error in `FinalizeSync` instead of ignoring it - added `SyncAndRestore` test for non-default branch stay behavior - moved changelog entry from Changed to Fixed section Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
RestoreAfterSyncto leave repos on the default branch instead of the original branch after syncingdev repo prunefrom failing with "cannot delete branch used by worktree" when the merged branch is currently checked outTest plan
make buildcompiles successfullydev repo syncfollowed bydev repo pruneand verify no "used by worktree" errors🤖 Generated with Claude Code