Commit be1ca115 authored by Stan Hu's avatar Stan Hu

Apply suggestion to support/self-update-git-worktree

parent f661f0d7
......@@ -6,18 +6,16 @@ def run(cmd)
end
ci_project_dir = ENV['CI_PROJECT_DIR']
ci_sha = ENV.fetch('CI_COMMIT_SHA', '')
ci_sha = ENV['CI_COMMIT_SHA']
# We need to retrieve the commit SHA if the source project is a fork
if ci_project_dir && !ci_sha.empty?
if ci_project_dir && ci_sha
run(%W[git remote add source #{ci_project_dir}])
run(%W[git fetch source #{ci_sha}])
end
cmd = if ci_sha.empty?
%w[git merge --ff-only origin/master]
if ci_sha
run(%w[git merge --ff-only origin/master])
else
%W[git checkout #{ci_sha}]
run(%W[git checkout #{ci_sha}])
end
run(cmd)
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