Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch commits from non-default branches using remotes #1086

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

william-stacken
Copy link

@william-stacken william-stacken commented Mar 11, 2025

Description

This PR adds the ability to make use of a query param to a remote API, to fetch commits from non-default branches. The query param is derived from the commit range given to git cliff. For example, if the range is v1.0..v1.1, then the param becomes v1.1. If the range is v1.0..HEAD, then the query param is omitted and the default branch is used, as before.

Motivation and Context

Allows git cliff to support trunk-based workflows, meaning that release notes will be correctly generated from hotfix branches that are not indented to be merged into the deefault branch.
Fixes #1050

How Has This Been Tested?

I ran git-cliff prevtag..hotfixtag --config cliff.toml --tag hotfixtag --github-repo my-org/my-private-repo, before and after applying these changes. I got the expected output with these changes, and got no output without them.

I am not able to test the non-GitHub remotes, but I found the equivalent query parameters in their respective docs
gitlab
gitea
bitbucket

Screenshots / Logs (if applicable)

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

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.

@william-stacken william-stacken requested a review from orhun as a code owner March 11, 2025 10:32
Copy link

welcome bot commented Mar 11, 2025

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

@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2025

Codecov Report

Attention: Patch coverage is 15.00000% with 85 lines in your changes missing coverage. Please review.

Project coverage is 41.13%. Comparing base (bf50336) to head (434ae64).

Files with missing lines Patch % Lines
git-cliff/src/lib.rs 0.00% 37 Missing ⚠️
git-cliff-core/src/changelog.rs 48.28% 15 Missing ⚠️
git-cliff-core/src/remote/gitlab.rs 11.12% 8 Missing ⚠️
git-cliff-core/src/remote/bitbucket.rs 0.00% 7 Missing ⚠️
git-cliff-core/src/remote/gitea.rs 0.00% 7 Missing ⚠️
git-cliff-core/src/remote/github.rs 0.00% 7 Missing ⚠️
git-cliff-core/src/remote/mod.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1086      +/-   ##
==========================================
- Coverage   41.42%   41.13%   -0.28%     
==========================================
  Files          21       21              
  Lines        1811     1831      +20     
==========================================
+ Hits          750      753       +3     
- Misses       1061     1078      +17     
Flag Coverage Δ
unit-tests 41.13% <15.00%> (-0.28%) ⬇️

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.

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.

Fetch commits from non-default branches on GitHub
2 participants