fix: repair worktree starts from origin/<default-branch>
When repairing a stale polecat worktree, start from origin/<default-branch> instead of the bare repo's HEAD. This ensures repaired polecats have the latest fetched commits rather than potentially stale code. - Add WorktreeAddFromRef to git package for creating worktrees from a ref - RepairWorktreeWithOptions now uses origin/<default-branch> as start point - Respects rig's configured default branch (main, master, etc.) Based on PR #112 by markov-kernel. Test changes from that PR can be submitted separately. Closes #101 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: markov-kernel <markov-kernel@users.noreply.github.com>
This commit is contained in:
committed by
Steve Yegge
parent
af95b7b7f4
commit
bef5a10250
@@ -523,6 +523,13 @@ func (g *Git) WorktreeAdd(path, branch string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// WorktreeAddFromRef creates a new worktree at the given path with a new branch
|
||||
// starting from the specified ref (e.g., "origin/main").
|
||||
func (g *Git) WorktreeAddFromRef(path, branch, startPoint string) error {
|
||||
_, err := g.run("worktree", "add", "-b", branch, path, startPoint)
|
||||
return err
|
||||
}
|
||||
|
||||
// WorktreeAddDetached creates a new worktree at the given path with a detached HEAD.
|
||||
func (g *Git) WorktreeAddDetached(path, ref string) error {
|
||||
_, err := g.run("worktree", "add", "--detach", path, ref)
|
||||
|
||||
Reference in New Issue
Block a user