Skip to content

Conversation

@joluizquierdo
Copy link

@joluizquierdo joluizquierdo commented Oct 1, 2025

This ensures that unreleased commits on feature/develop branches are properly matched with their corresponding pull requests.

Fixes issue where GitHub metadata (PR numbers, titles) was not populated for unreleased commits on non-default branches.

Also fixed .gitignore to ignore target/ insteand of /target

Description

When running git-cliff --unreleased without a specific range, it now uses
the current branch name for GitHub API calls instead of defaulting to the
repository's default branch.

Motivation and Context

Fixing of the following issue: #1274

How Has This Been Tested?

Tested against some repos in my company, where the error was discovered

Screenshots / Logs (if applicable)

Please everything is detailed in the issue linked to the PR

Types of Changes

  • Bug fix (non-breaking change which fixes an issue). I don't know if this change might break other users usage....

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

When running git-cliff --unreleased without a specific range, it now
uses
the current branch name for GitHub API calls instead of defaulting to
the
repository's default branch.

This ensures that unreleased commits on feature/develop branches are
properly matched with their corresponding pull requests.

Fixes issue where GitHub metadata (PR numbers, titles) was not populated
for unreleased commits on non-default branches.

Also fixed .gitignore to ignore target/ insteand of /target
@welcome
Copy link

welcome bot commented Oct 1, 2025

Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.62%. Comparing base (0b6af12) to head (869e7b0).

Files with missing lines Patch % Lines
git-cliff-core/src/changelog.rs 84.62% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1275      +/-   ##
==========================================
+ Coverage   43.46%   43.62%   +0.16%     
==========================================
  Files          22       22              
  Lines        1972     1981       +9     
==========================================
+ Hits          857      864       +7     
- Misses       1115     1117       +2     
Flag Coverage Δ
unit-tests 43.62% <84.62%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@joluizquierdo
Copy link
Author

Hello, like I remarked in the issue that I opened today, I have no prior expirience with rust, I'm more familiar with nodejs, python and other languages, I do know how to write code.

Therefore, with some help of the AI, I was able to locate the fix and propose a extreamly clumpsy suggestion.

I hope to at least point the error and save you time!

@ognis1205
Copy link
Contributor

cc: @orhun

I haven't gone through this PR in detail yet, but it seems related to #1264, so perhaps it could be tied together for a more comprehensive implementation. Still, this one looks fine to review as-is.

Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

This looks mostly good and makes sense :) Left a comment.

Comment on lines +469 to +474
// Get current branch name
use std::process::Command;
let output = Command::new("git")
.args(&["rev-parse", "--abbrev-ref", "HEAD"])
.output();

Copy link
Owner

Choose a reason for hiding this comment

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

We should avoid running git and use git2 instead :)

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.

4 participants