Skip to content

Commit

Permalink
Set --dirty to .1.dirty in git describe call
Browse files Browse the repository at this point in the history
Without this patch, if you've tagged v1.2.3, and then off that make some
edits, GVB.version would then be 1.2.3.dirty.  The problem is that RubyGems
treats a string as being LESS THAN ZERO, so 1.2.3.dirty < 1.2.3.  In order
to make a dirty tree based off v1.2.3 be considered a newer version than
1.2.3, we need to make the version 1.2.3.1.dirty, which is what
--dirty='.1.dirty' does for us.
  • Loading branch information
mpalmer committed Feb 17, 2014
1 parent a73b00e commit 3c4eb42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/git-version-bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def self.caller_gemspec
end

def self.version(gem = nil)
git_ver = `git describe --dirty --match='v[0-9]*.[0-9]*.*[0-9]' 2>/dev/null`.
git_ver = `git describe --dirty='.1.dirty' --match='v[0-9]*.[0-9]*.*[0-9]' 2>/dev/null`.
strip.
gsub(/^v/, '').
gsub('-', '.')
Expand Down

0 comments on commit 3c4eb42

Please sign in to comment.