Fetch commits from non-default branches using remotes #1086
+278
−118
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.
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 becomesv1.1
. If the range isv1.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
Checklist: