-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Add commit_range to template context #1041
Comments
Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️ |
Good idea! We simply need to add Marking this as good-first-issue, would you be interested in contributing? |
i'll try to make some time next week and have a look. |
Perfect, assigned to you! Let me know if you need any assistance. |
Hey, i finally could make the time to have a look. Unless i'm overlooking something this might not be as straight forward as thought. Here are my observations: Currently the commit range is passed when getting the commits for changelog creation, we don't have ownership of the repo there. //...
let first_commit = commits.first().unwrap().id();
let last_commit = commits.last().unwrap().id();
let commit_range =
CommitRange::new(&first_commit.to_string(), &last_commit.to_string());
for git_commit in commits.iter().rev() {
let release = releases.last_mut().unwrap();
//..
release.commit_range = Some(commit_range.clone());
// ... with /// Commit range (from..to)
pub struct CommitRange {
from: String,
to: String,
} From what i could tell this is currently not easily testable though, right? Let me know your thoughts. |
Can you elaborate on the use case for this request? Do you want to generate a diff between a change's commit and the previous release? |
I think yes... I cannot think of another use case.
Hmm yeah, good point.
Yup, that looks good to me. I think that would be the most correct way of getting the range.
Can you elaborate this a bit? What do you want to do exactly? |
yes, as stated:
in my case this would be achieveable via the commit hashes
my proposal would put the logic in |
I think we can use test fixtures for testing this functionality in the first phase. And yes, I think |
Ah, missed those. It looks like commits are created "on the fly" there. Any quick idea how i can deterministically create the same commit sha every time? Apply patches? I'll try to get a pr going some time soon. |
Good question. I think applying patches might work. Or we can install a tool like Edit: Just do this in #!/usr/bin/env bash
set -e
git remote add origin https://github.com/orhun/git-cliff-readme-example
git pull origin master
git fetch --tags |
Hey,
i would like to add links to diffs of certain files to the changelog.
Is there a way to get the commit range git cliff uses or was called with (in my case
git cliff commitA..commitB
)? As far as i could see it's not part of the context.Thanks
The text was updated successfully, but these errors were encountered: