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

Feature request -- use commit refs instead of tags #234

Open
notjames opened this issue Feb 22, 2023 · 2 comments · May be fixed by #241
Open

Feature request -- use commit refs instead of tags #234

notjames opened this issue Feb 22, 2023 · 2 comments · May be fixed by #241

Comments

@notjames
Copy link

Expected Behavior

This has a lot of potential for us. I'm curious, is it possible to get a changelog using either branch names or commit refs instead of tags? We're still planning through how we need to use this tool, but so far in our prototyping, we've been working with the convention of origin/master..HEAD as we do not use tagging in our branches or releases given the nature of our product (so far). We are investigating potential use of tags, but that is a decently huge paradigm shift for us. So, I'm seeking for thoughts and possibilities at this point.

Your Environment

  • OS: Linux/Ubuntu
  • git-chglog version: latest?

actually, I'm not sure about the version because -v and --version is simply giving me a changelog instead of outputting a version for the tool.

@davidalpert
Copy link

@mavogel @wadackel I would also like to generate changelog notes based on a pair of commit references, in my case the head and base refs of a Pull Request

my use case is to generate a release note fragment in a pull request based just on the changes in that pull request as a way to provide feedback to the developers on my team how their commit messages will render in the customer-facing release notes we intend to generate later (based on tags in our release branch).

if this capability is aligned with this project's goals and vision I would be willing to prepare a contribution to implement.

I look forward to your thoughts and direction.

@davidalpert
Copy link

it looks like the functionality I'm looking for is already present in this method https://github.com/git-chglog/git-chglog/blob/v0.15.4/chglog.go#L226-L253

there is no real reason that I can tell for this readUnreleased(..) method to take in a slice of *Tag; if instead we pushed the responsibility for forming the rev list out so that this method could accept any rev list, that would probably move us towards being able to generate release fragments for an arbitrary range of commits by standard git ref syntax.

func (gen *Generator) readUnreleased(tags []*Tag) (*Unreleased, error) {
	if gen.config.Options.NextTag != "" {
		return &Unreleased{}, nil
	}

	rev := "HEAD"

	if len(tags) > 0 {
		rev = tags[0].Name + "..HEAD"
	}

	commits, err := gen.commitParser.Parse(rev)
	if err != nil {
		return nil, err
	}

	commitGroups, mergeCommits, revertCommits, noteGroups := gen.commitExtractor.Extract(commits)

	unreleased := &Unreleased{
		CommitGroups:  commitGroups,
		Commits:       commits,
		MergeCommits:  mergeCommits,
		RevertCommits: revertCommits,
		NoteGroups:    noteGroups,
	}

	return unreleased, nil
}

maybe supporting generating unreleased notes about any arbitrary commits while still requiring tags to be in use for the standard use case is a nice compromise?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants