Skip to content

fix: propagate fatal git errors from hasCommits - #331

Merged
404-Page-Found merged 8 commits into
mainfrom
fix/306-preserve-git-errors
Sep 24, 2026
Merged

404-Page-Found merged 8 commits into
mainfrom
fix/306-preserve-git-errors

Conversation

@404-Page-Found

@404-Page-Found 404-Page-Found commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #306

hasCommits() now treats only an unborn symbolic HEAD with no stored branch ref as the legitimate zero-commit case. Fatal Git failures (including detached or corrupt HEAD/refs) are rethrown with Git stderr preserved.

Adds a regression test that corrupts the current branch ref and verifies the Git failure is surfaced instead of being reported as an empty repository.

Validation attempted locally, but the execution environment cannot resolve github.com. CI should run the full format and test matrix.

Review in cubic

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 7199fb4e-983a-4cf6-8181-528ea3163887

📥 Commits

Reviewing files that changed from the base of the PR and between 65718e4 and 881298f.

📒 Files selected for processing (2)
  • src/git/diff.ts
  • tests/git-diff.test.mjs

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread tests/git-diff.test.mjs Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Shadow auto-approve: would not auto-approve because issues were found.

Re-trigger cubic

Comment thread src/git/diff.ts Outdated
@sonarqubecloud

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would require human review. This PR changes hasCommits() to propagate fatal Git errors unless the repo is unborn; a human should review the error propagation implications.

Re-trigger cubic

@404-Page-Found
404-Page-Found merged commit 673b503 into main Sep 24, 2026
7 checks passed
@404-Page-Found
404-Page-Found deleted the fix/306-preserve-git-errors branch September 24, 2026 01:31
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.

[Bug] hasCommits() turns fatal Git errors into a false “no commits” result

1 participant