fix(remote): resolve HEAD to current branch for remote metadata#1535
Closed
leno23 wants to merge 1 commit into
Closed
fix(remote): resolve HEAD to current branch for remote metadata#1535leno23 wants to merge 1 commit into
leno23 wants to merge 1 commit into
Conversation
When the commit range ends with HEAD (e.g. from --unreleased), remote integrations previously passed None as the ref, causing GitHub/GitLab APIs to query the default branch instead of the current branch. Resolve HEAD to the local branch name (or commit SHA when detached) via git2 before fetching remote metadata. Fixes #1274 Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1535 +/- ##
==========================================
+ Coverage 48.63% 48.66% +0.03%
==========================================
Files 26 26
Lines 2287 2300 +13
==========================================
+ Hits 1112 1119 +7
- Misses 1175 1181 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HEAD(e.g.v1.0.0..HEADfrom--unreleased), remote integrations now resolveHEADto the current local branch name before calling GitHub/GitLab/etc. APIsHEADwas mapped toNone, which made APIs fall back to the repository default branch and miss PR metadata for commits on feature branchesRepository::head_ref_name()instead of spawninggit rev-parseFixes #1274
Supersedes the approach in draft PR #1275 with a git2-based implementation aligned with existing repository handling.
Test plan
cargo test -p git-cliff-core repo::test::head_ref_name_returns_current_branch