Fix: exception in case no tags in repo

This commit is contained in:
Petr Korolev 2015-03-05 14:33:01 +02:00
parent 6159ebba2f
commit 419e7e78ad
2 changed files with 5 additions and 22 deletions

View File

@ -1,23 +1,5 @@
# Change Log
## [v0.0.3](https://github.com/skywinder/changelog_test/tree/v0.0.3) (2015-03-04)
[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.2...v0.0.3)
**Merged pull requests:**
- fix \#3. hotfix. Should appear in v0.0.3 [\#4](https://github.com/skywinder/changelog_test/pull/4) ([skywinder](https://github.com/skywinder))
## [v0.0.2](https://github.com/skywinder/changelog_test/tree/v0.0.2) (2015-03-04)
[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.1...v0.0.2)
**Merged pull requests:**
- Here is a test hotfix should appear in v.0.0.2 [\#2](https://github.com/skywinder/changelog_test/pull/2) ([skywinder](https://github.com/skywinder))
## [v0.0.1](https://github.com/skywinder/changelog_test/tree/v0.0.1) (2015-03-02)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

View File

@ -229,7 +229,7 @@ module GitHubChangelogGenerator
log = ''
if @options[:unreleased]
if @options[:unreleased] && @all_tags.count != 0
unreleased_log = self.generate_log_between_tags(self.all_tags[0], nil)
if unreleased_log
log += unreleased_log
@ -239,8 +239,9 @@ module GitHubChangelogGenerator
(1 ... self.all_tags.size).each { |index|
log += self.generate_log_between_tags(self.all_tags[index], self.all_tags[index-1])
}
log += generate_log_between_tags(nil, self.all_tags.last)
if @all_tags.count != 0
log += generate_log_between_tags(nil, self.all_tags.last)
end
log
end
@ -374,7 +375,7 @@ module GitHubChangelogGenerator
def delete_by_time(array, hash_key, older_tag = nil, newer_tag = nil)
raise 'At least on of the tags should be not nil!' if (older_tag.nil? && newer_tag.nil?)
raise 'At least one of the tags should be not nil!' if (older_tag.nil? && newer_tag.nil?)
newer_tag_time = self.get_time_of_tag(newer_tag)
older_tag_time = self.get_time_of_tag(older_tag)