lib/gitscape/base.rb in gitscape-1.7.2 vs lib/gitscape/base.rb in gitscape-1.7.3
- old
+ new
@@ -153,11 +153,11 @@
# Check that the working copy is clean
exit 1 unless git_working_copy_is_clean
source_branch = "#{branch_type}/#{source_branch}"
-
+
previous_branch = current_branch_name
if previous_branch.to_s.start_with? "#{branch_type}/"
source_branch = previous_branch
end
@@ -382,11 +382,11 @@
end
end
# Get the system's current git version
def git_version
- @git_version ||= `git --version`.strip.split(" ").last
+ @git_version ||= `git --version`.match(/\d+(?:\.\d+)+/).to_s
end
# Check if the system's git version is at least as recent as the version specified
def git_version_at_least(min_version)
def split_version(v)
@@ -394,14 +394,17 @@
end
local_version = split_version(git_version)
min_version = split_version(min_version)
raise "Git version string must have 4 parts" if min_version.size != 4
-
4.times do |i|
+ if local_version[i].nil?
+ return false
+ end
next if local_version[i] == min_version[i]
return local_version[i] > min_version[i]
end
+
true # If you get all the way here, all 4 positions match precisely
end
def finish_usage_string(branch_type)
"expected usage: #{branch_type}_finish [<#{branch_type}_branch>]