lib/roger/release/scm/git.rb in roger-1.9.0 vs lib/roger/release/scm/git.rb in roger-1.9.1
- old
+ new
@@ -48,16 +48,16 @@
protected
def get_previous_tag_name
# Get list of SHA1 that have a ref
- sha1s = `git --git-dir=#{safe_git_dir} log --pretty='%H' --simplify-by-decoration`
+ sha1s = `git --git-dir=#{safe_git_dir} log --pretty="%H" --simplify-by-decoration`
sha1s = sha1s.split("\n")
tags = []
while tags.size < 2 && sha1s.any?
sha1 = sha1s.shift
- tag = `git --git-dir=#{safe_git_dir} describe --tags --exact-match #{sha1} 2>/dev/null`
+ tag = `git --git-dir=#{safe_git_dir} describe --tags --exact-match #{sha1}`
tag = tag.strip
tags << tag unless tag.empty?
end
tags.last
rescue
@@ -82,15 +82,15 @@
# Some hackery to determine if ref is on a tagged version or not
# @return [String, nil] Will return version number if available, nil otherwise
def scm_version(ref)
return nil unless File.exist?(git_dir)
- version = `git --git-dir=#{safe_git_dir} describe --tags #{ref} 2>&1`
+ version = `git --git-dir=#{safe_git_dir} describe --tags #{ref}`
- if $CHILD_STATUS.to_i > 0
+ if $CHILD_STATUS.to_i.positive?
# HEAD is not a tagged version, get the short SHA1 instead
- version = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:"%h" -s 2>&1`
+ version = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:"%h" -s`
else
# HEAD is a tagged version, if version is prefixed with "v" it will be stripped off
version.gsub!(/^v/, "")
end
@@ -103,10 +103,10 @@
# @return [Time, nil] Returns time if available and parseable, nil otherwise
def scm_date(ref)
return nil unless File.exist?(git_dir)
# Get the date in epoch time
- date = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:"%ct" -s 2>&1`
+ date = `git --git-dir=#{safe_git_dir} show #{ref} --format=format:"%ct" -s`
Time.at(date.to_i) if date =~ /\d+/
rescue RuntimeError
nil
end
end