Skip to content

fix: watch-pr crashes on repos with non-main default branch#139

Merged
jdutton merged 1 commit intomainfrom
feat/watch-pr-url-support
Mar 9, 2026
Merged

fix: watch-pr crashes on repos with non-main default branch#139
jdutton merged 1 commit intomainfrom
feat/watch-pr-url-support

Conversation

@jdutton
Copy link
Owner

@jdutton jdutton commented Mar 9, 2026

Summary

  • Bug: watch-pr hardcoded origin/main in fetchFileChanges, causing it to crash with fatal: ambiguous argument 'origin/main...HEAD' on repos using master, develop, or other base branches
  • Fix: Pass the PR's actual base branch (from GitHub metadata) to fetchFileChanges instead of hardcoding main
  • Not a regression — this was always hardcoded since fetchFileChanges was introduced

Test plan

  • New test: should use the provided base branch instead of hardcoded main verifies origin/master is passed through
  • Existing tests updated to pass baseBranch parameter
  • pnpm validate passes (all pre-commit checks green)
  • Manually verified with vv watch-pr on ihiservices/MPNAdminAngular PR Fix Hardcoded 'origin/main' in pre-commit Command #2 (base branch: master)

🤖 Generated with Claude Code

fetchFileChanges hardcoded origin/main for git diff --numstat, causing
watch-pr to fail on repos using master, develop, or other base branches.
Now uses the PR's actual base branch from GitHub metadata.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2026

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.72%. Comparing base (3d57c17) to head (efcc78d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #139   +/-   ##
=======================================
  Coverage   85.72%   85.72%           
=======================================
  Files         115      115           
  Lines       14910    14911    +1     
  Branches     3217     3217           
=======================================
+ Hits        12782    12783    +1     
  Misses       2128     2128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jdutton jdutton merged commit ba93834 into main Mar 9, 2026
9 checks passed
@jdutton jdutton deleted the feat/watch-pr-url-support branch March 9, 2026 17:25
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