Skip to content

Actionable error messages for git init sidecar sync failures#361

Merged
schurchleycci merged 2 commits into
mainfrom
investigate-issues-350-351
May 29, 2026
Merged

Actionable error messages for git init sidecar sync failures#361
schurchleycci merged 2 commits into
mainfrom
investigate-issues-350-351

Conversation

@schurchleycci
Copy link
Copy Markdown
Contributor

Summary

Changes

  • internal/gitutil/gitutil.go — add ErrNoOriginHEAD sentinel; MergeBase() checks whether the upstream is set before returning the generic no-origin-HEAD error, and wraps ErrNoOriginHEAD when it is
  • internal/sidecar/errors.go — add NoOriginRemoteError type (mirrors existing RemoteBaseError pattern)
  • internal/sidecar/sync.go — wrap DetectOrgAndRepo failures as NoOriginRemoteError instead of a plain fmt.Errorf
  • internal/cmd/sidecar.go — handle NoOriginRemoteError and ErrNoOriginHEAD in both newSidecarSyncCmd and sidecarSetupSync error paths

Note on PR #339

This PR is complementary to #339 (sync redesign). #339 renames the sync entry point and changes MergeBase()'s fallback command but does not address error surfacing. If #339 merges first, two small adaptations are needed: apply NoOriginRemoteError wrapping to both DetectOrgAndRepo calls in #339's new Bootstrap/Sync functions, and move the ErrNoOriginHEAD check onto the git merge-base HEAD origin/HEAD fallback that #339 introduces.

Test plan

  • All unit and acceptance tests pass (task test)
  • Lint clean (task lint)

🤖 Generated with Claude Code

schurchleycci and others added 2 commits May 25, 2026 14:51
)

When origin remote is not configured, surface a typed NoOriginRemoteError
with a suggestion to run git remote add origin instead of the generic
"An unknown error occurred" message.

When the upstream tracking branch is set but origin/HEAD is missing (common
after git init + push without fetch), detect the specific case in MergeBase
and surface ErrNoOriginHEAD with a suggestion to run git fetch origin &&
git remote set-head origin -a instead of the unhelpful "Push your branch"
suggestion that was already followed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@schurchleycci schurchleycci merged commit ea8f4ed into main May 29, 2026
6 checks passed
@schurchleycci schurchleycci deleted the investigate-issues-350-351 branch May 29, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants