* fix(daemon): handle diverged sync branch with fetch-rebase-retry on push When pushing to the sync branch, if the remote has newer commits that the local worktree doesn't have, the push would fail with "fetch first" error and the daemon would log the failure without recovery. Bug scenario: 1. Clone A pushes commit X to sync branch 2. Clone B has local commit Y (not based on X) 3. Clone B's push fails with "fetch first" error 4. Without this fix: daemon logs failure and stops 5. With this fix: daemon fetches, rebases Y on X, and retries push This fix adds fetch-rebase-retry logic to gitPushFromWorktree(): 1. Detect push rejection due to remote having newer commits 2. Fetch the latest remote sync branch 3. Rebase local commits on top of remote 4. Retry the push If rebase fails (e.g., due to conflicts), the rebase is aborted and an error is returned with helpful context. This allows multiple clones to push to the same sync branch without manual intervention, as long as the changes don't conflict. Adds integration test TestGitPushFromWorktree_FetchRebaseRetry that verifies the fetch-rebase-retry behavior with diverged branches. * fix: resolve all golangci-lint errors (cherry-pick from fix/linting-errors) Cherry-picked linting fixes to ensure CI passes. --------- Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
47 KiB
47 KiB