Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Changes:
after 0.9.0, where before it was the last tag by name.
* `-p` (`--point`) now splits commit messages into points and the
default doesn't; the two were the wrong way round.
* `vclog-bump` gives the next patch version when nothing has changed
since the last release, where before it failed.
* Find the history file whatever its case (`History.md`, `HISTORY.md`).
* Find a project's config file (`etc/vclog.rb`, `config/vclog.rb`,
`.vclog`, ...), which the last code on master failed to do.
Expand Down
6 changes: 4 additions & 2 deletions lib/vclog/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,10 @@ def report(options)
#
def bump
last_release = releases(changes).first
max = last_release.changes.map{ |c| c.level }.max
if max > 1
max = last_release.changes.map{ |c| c.level }.compact.max
if max.nil?
bump_part('patch') # nothing has changed since the last release
elsif max > 1
bump_part('major')
elsif max >= 0
bump_part('minor')
Expand Down
13 changes: 13 additions & 0 deletions test/case_git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,17 @@
@repo.bump_part('patch').assert == "0.10.1"
end

test "bump is a patch when nothing has changed since the last release" do
Dir.mktmpdir do |dir|
env = {'GIT_CONFIG_GLOBAL'=>File::NULL, 'GIT_CONFIG_SYSTEM'=>File::NULL}
[ %w[init -q -b master], %w[config user.name Tester], %w[config user.email tester@example.com],
%w[config commit.gpgsign false], %w[config tag.gpgsign false],
['commit', '-q', '--allow-empty', '-m', 'Start.'], %w[tag -a -m First 1.2.3]
].each do |args|
system(env, 'git', '-C', dir, *args, :out=>File::NULL, :err=>File::NULL).assert == true
end
VCLog::Repo.new(dir, {}).bump.assert == "1.2.4"
end
end

end
Loading