8000 Setting --base param automatically sets --since param with unwanted side effects · Issue #901 · github-changelog-generator/github-changelog-generator · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Setting --base param automatically sets --since param with unwanted side effects #901
Open
@sappelhoff

Description

@sappelhoff

I first reported this in the gitter chat (see thread). Now opening an issue so that the problem can be properly addressed.

background

Users can set the --base parameter to migrate from an old changelog to github-changelog-generator ... asking github-changelog-generator to append the "old" changelog (i.e., the "base) to the new, automatically generated changelog.

Crucially, github-changelog-generator assumes that the old changelog contains proper versions and that each of those versions in the old changelog corresponds to a tag in the GitHub repo.

This assumptation was probably intended as a nice feature to (i) parse the old changelog for all versions, (ii) take the most recent "old" version, and (iii) use that version as the automatic input into the --since parameter.

See the code implementation:

# @return [Object] try to find newest tag using #Reader and :base option if specified otherwise returns nil
def since_tag
@since_tag ||= options.fetch(:since_tag) { version_of_first_item }
end
def due_tag
@due_tag ||= options.fetch(:due_tag, nil)
end
def version_of_first_item
return unless File.file?(options[:base].to_s)
sections = GitHubChangelogGenerator::Reader.new.read(options[:base])
sections.first["version"] if sections && sections.any?
end

problem

Unfortunately, this becomes problematic once the implicit assumption is not fulfilled.

For example, when an old changelog's versions do not correspond with the tags in the git history (which is entirely possible, strange things happen during migration ... and sometimes people migrate from one platform to another or to another version control system altogether).

The problem surfaced only recently, with #621 introducing an error when a tag specified with --since could not be found.

solution

I think this issue could be reasonably solved by allowed to explicitly set --since-tag to some "None" or "Null" value ... and thus preventing an automatic overriding of it if --base is specified.

Alternatively, it would help us if we could specify a "commit" instead of a tag for --since-tag. Then we would just put the first commit in our repo for --since-tag and it wouldn't get overridden when we specify --base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughacktoberfestEnjoy flashmob: https://hacktoberfest.digitalocean.com. Get a swag!help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0