Commit 47cb20b4 authored by Toon Claes's avatar Toon Claes

Merge branch 'sh-fix-issue-505' into 'master'

Fetch the commit SHA from the source project

See merge request !686
parents e1a27058 53bec30d
Pipeline #64691100 canceled with stages
#!/usr/bin/env ruby
ci_sha = ENV.fetch('CI_COMMIT_SHA', '')
def run(cmd)
puts "(support/self-update-git-worktree) > #{cmd.join(' ')}"
system(*cmd)
end
cmd = if ci_sha.empty?
%w[git merge --ff-only origin/master]
else
%W[git checkout #{ci_sha}]
ci_project_dir = ENV['CI_PROJECT_DIR']
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
run(%W[git remote add source #{ci_project_dir}])
run(%W[git fetch source #{ci_sha}])
end
puts cmd.join(' ')
exec(*cmd)
if ci_sha
run(%W[git checkout #{ci_sha}])
else
run(%w[git merge --ff-only origin/master])
end
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