Fixed issue #304 - entries of previous tags are included.
This commit is contained in:
parent
9b0d41713d
commit
83dcb3cdf9
|
@ -11,7 +11,7 @@ module GitHubChangelogGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
class Generator
|
class Generator
|
||||||
attr_accessor :options, :filtered_tags, :github, :tag_section_mapping
|
attr_accessor :options, :filtered_tags, :github, :tag_section_mapping, :sorted_tags
|
||||||
|
|
||||||
# A Generator responsible for all logic, related with change log generation from ready-to-parse issues
|
# A Generator responsible for all logic, related with change log generation from ready-to-parse issues
|
||||||
#
|
#
|
||||||
|
|
|
@ -126,8 +126,9 @@ module GitHubChangelogGenerator
|
||||||
def generate_unreleased_section
|
def generate_unreleased_section
|
||||||
log = ""
|
log = ""
|
||||||
if options[:unreleased]
|
if options[:unreleased]
|
||||||
unreleased_log = generate_log_between_tags(filtered_tags[0], nil)
|
start_tag = filtered_tags[0] || sorted_tags.last
|
||||||
log += unreleased_log if unreleased_log
|
unreleased_log = generate_log_between_tags(start_tag, nil)
|
||||||
|
log += unreleased_log if unreleased_log
|
||||||
end
|
end
|
||||||
log
|
log
|
||||||
end
|
end
|
||||||
|
|
|
@ -72,6 +72,8 @@ module GitHubChangelogGenerator
|
||||||
# in case if not tags specified - return unchanged array
|
# in case if not tags specified - return unchanged array
|
||||||
return issues if older_tag.nil? && newer_tag.nil?
|
return issues if older_tag.nil? && newer_tag.nil?
|
||||||
|
|
||||||
|
older_tag = ensure_older_tag(older_tag, newer_tag)
|
||||||
|
|
||||||
newer_tag_time = newer_tag && get_time_of_tag(newer_tag)
|
newer_tag_time = newer_tag && get_time_of_tag(newer_tag)
|
||||||
older_tag_time = older_tag && get_time_of_tag(older_tag)
|
older_tag_time = older_tag && get_time_of_tag(older_tag)
|
||||||
|
|
||||||
|
@ -92,6 +94,12 @@ module GitHubChangelogGenerator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ensure_older_tag(older_tag, newer_tag)
|
||||||
|
return older_tag if older_tag
|
||||||
|
idx = sorted_tags.index { |t| t["name"] == newer_tag["name"] }
|
||||||
|
sorted_tags[idx - 1]
|
||||||
|
end
|
||||||
|
|
||||||
def tag_older_new_tag?(newer_tag_time, time)
|
def tag_older_new_tag?(newer_tag_time, time)
|
||||||
tag_in_range_new = if newer_tag_time.nil?
|
tag_in_range_new = if newer_tag_time.nil?
|
||||||
true
|
true
|
||||||
|
|
|
@ -10,8 +10,8 @@ module GitHubChangelogGenerator
|
||||||
included_tags = filter_excluded_tags(all_tags)
|
included_tags = filter_excluded_tags(all_tags)
|
||||||
|
|
||||||
fetch_tags_dates(all_tags) # Creates a Hash @tag_times_hash
|
fetch_tags_dates(all_tags) # Creates a Hash @tag_times_hash
|
||||||
sorted_tags = sort_tags_by_date(included_tags)
|
@sorted_tags = sort_tags_by_date(included_tags)
|
||||||
@filtered_tags = get_filtered_tags(included_tags)
|
@filtered_tags = get_filtered_tags(included_tags)
|
||||||
|
|
||||||
@tag_section_mapping = build_tag_section_mapping(@filtered_tags, sorted_tags)
|
@tag_section_mapping = build_tag_section_mapping(@filtered_tags, sorted_tags)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user