Skip to content

fix(git): prevent fatal error for missing 'origin' remote - #871

Merged
BYK merged 1 commit into
masterfrom
seer/fix/git-remote-check
Aug 10, 2026
Merged

fix(git): prevent fatal error for missing 'origin' remote#871
BYK merged 1 commit into
masterfrom
seer/fix/git-remote-check

Conversation

@sentry

@sentry sentry Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The getDefaultBranch function in src/utils/git.ts previously relied on git remote set-head <remoteName> --auto to determine the default branch. If the specified remote (e.g., 'origin') did not exist in the repository, this command would fail with a generic git error: "fatal: 'origin' does not appear to be a git repository" (exit code 128).

This fix introduces an explicit check within getDefaultBranch to verify the existence of the remoteName using git.getRemotes(). If the remote is not found, a ConfigurationError is now thrown with a clear, actionable message, guiding the user or test environment to correctly configure the remote. This prevents the propagation of an opaque git error and provides a better debugging experience, especially in isolated test setups like the craft-verify-bun-lock scenario.

Fixes CRAFT-2P

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@BYK
BYK marked this pull request as ready for review August 10, 2026 16:28
@sentry
sentry Bot deployed to false August 10, 2026 16:29 Active
@sentry
sentry Bot requested a review from BYK August 10, 2026 16:30
@BYK
BYK merged commit 32f5462 into master Aug 10, 2026
21 checks passed
@BYK
BYK deleted the seer/fix/git-remote-check branch August 10, 2026 16:46
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