Commit 32886279 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'secpick-fix-default-sha' into 'master'

Fix the default sha for bin/secpick

See merge request gitlab-org/gitlab!33545
parents eb63ad83 b327a93e
...@@ -25,12 +25,8 @@ module Secpick ...@@ -25,12 +25,8 @@ module Secpick
@options[:try] == true @options[:try] == true
end end
def original_branch
@options[:branch].strip
end
def source_branch def source_branch
branch = "#{original_branch}-#{@options[:version]}" branch = "#{@options[:branch]}-#{@options[:version]}"
branch.prepend("#{BRANCH_PREFIX}-") unless branch.start_with?("#{BRANCH_PREFIX}-") branch.prepend("#{BRANCH_PREFIX}-") unless branch.start_with?("#{BRANCH_PREFIX}-")
branch.freeze branch.freeze
end end
...@@ -44,7 +40,7 @@ module Secpick ...@@ -44,7 +40,7 @@ module Secpick
"git checkout -B #{source_branch} #{@options[:remote]}/#{stable_branch} --no-track", "git checkout -B #{source_branch} #{@options[:remote]}/#{stable_branch} --no-track",
"git cherry-pick #{@options[:sha]}", "git cherry-pick #{@options[:sha]}",
"git push #{@options[:remote]} #{source_branch}", "git push #{@options[:remote]} #{source_branch}",
"git checkout #{original_branch}"] "git checkout #{@options[:branch]}"]
end end
def gitlab_params def gitlab_params
...@@ -121,8 +117,8 @@ module Secpick ...@@ -121,8 +117,8 @@ module Secpick
parser.parse! parser.parse!
options[:sha] ||= `git rev-parse HEAD` options[:sha] ||= `git rev-parse HEAD`.strip
options[:branch] ||= `git rev-parse --abbrev-ref HEAD` options[:branch] ||= `git rev-parse --abbrev-ref HEAD`.strip
options[:remote] ||= DEFAULT_REMOTE options[:remote] ||= DEFAULT_REMOTE
nil_options = options.select {|_, v| v.nil? } nil_options = options.select {|_, v| v.nil? }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment