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

filter tags correctly when `since_tag` is set to most recent tag #566

Merged
merged 2 commits into from Oct 5, 2017

Conversation

Projects
None yet
2 participants
@Crunch09
Contributor

Crunch09 commented Oct 4, 2017

Hey,
before this fix filtered_tags was empty which caused a fallback to the last tag in the sorted_tags array (which is the oldest tag).
There for no issues and PRs were filtered in that case.

fixes #555
fixes #304

filter tags correctly when `since_tag` is set to most recent tag
Before this fix [`filtered_tags`](https://github.com/skywinder/github-changelog-generator/blob/master/lib/github_changelog_generator/generator/generator_generation.rb#L132)
was empty which caused a fallback to the last tag in the sorted_tags array (which is the oldest tag).
There for no issues and PRs were filtered in that case.

fixes #555
fixes #304
@olleolleolle

If Enumerable#index:

  • actually misses, we get a nil
  • hits the first item in all_tags we get a 0

When we have hit the first item, the all_tags range is [0..0]. Then, we will now return a list which only includes the first all_tags element.

Before this change, the returned list would be the empty list.

One thing we can do with this PR, is to rely on the return value of Array#index, which is "int or nil". That means that if idx.present? could become if idx.

@olleolleolle olleolleolle added this to the v1.15.0 milestone Oct 5, 2017

@Crunch09

This comment has been minimized.

Contributor

Crunch09 commented Oct 5, 2017

Exactly! Thanks for the thorough explanation! 😅

That means that if idx.present? could become if idx.

I'll change this, wasn't sure which way you prefer.

@olleolleolle olleolleolle merged commit 64f4cd0 into github-changelog-generator:master Oct 5, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.06%) to 72.789%
Details

@olleolleolle olleolleolle added the bug label Oct 5, 2017

@Crunch09 Crunch09 deleted the Crunch09:since_tag_unreleased branch Oct 5, 2017

@olleolleolle

This comment has been minimized.

Collaborator

olleolleolle commented Oct 5, 2017

@Crunch09 Florian, thank you so much for taking up this issue and building this fix.

@Crunch09

This comment has been minimized.

Contributor

Crunch09 commented Oct 5, 2017

@olleolleolle You're very welcome! Thank you for maintaining this gem! Great project 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment