[refs #719] fixed errors with tags & history rewrite
This commit is contained in:
parent
7edcacee00
commit
902438b7b5
|
@ -176,16 +176,18 @@ class PullRequest < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir(path) do
|
Dir.chdir(path) do
|
||||||
system 'git', 'checkout', to_ref
|
system 'git', 'tag', '-d', from_ref, to_ref
|
||||||
system 'git', 'pull', 'origin', to_ref
|
system 'git fetch --tags'
|
||||||
if to_project_id == from_project_id
|
tags, head = repo.tags.map(&:name), to_project == from_project ? 'origin' : 'head'
|
||||||
system 'git', 'checkout', from_ref
|
unless tags.include? to_ref
|
||||||
system 'git', 'pull', 'origin', from_ref
|
system 'git', 'checkout', to_ref
|
||||||
else
|
system 'git', 'reset', '--hard', "origin/#{to_ref}"
|
||||||
system 'git', 'fetch', 'head', "+#{from_ref}:#{from_branch}"
|
end
|
||||||
|
unless tags.include? from_ref
|
||||||
|
system 'git', 'branch', '-D', from_branch
|
||||||
|
system 'git', 'fetch', head, "+#{from_ref}:#{from_branch}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# TODO catch errors
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def clean
|
def clean
|
||||||
|
|
Loading…
Reference in New Issue