Commit 5a115671 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Use rugged.references.delete to delete reference

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19746468
parent 56f69746
......@@ -1064,18 +1064,18 @@ class Repository
end
def with_tmp_ref(source_repository, source_branch_name)
random_string = SecureRandom.hex
tmp_ref = "refs/tmp/#{SecureRandom.hex}/head"
fetch_ref(
source_repository.path_to_repo,
"#{Gitlab::Git::BRANCH_REF_PREFIX}#{source_branch_name}",
"refs/tmp/#{random_string}/head"
tmp_ref
)
yield
ensure
FileUtils.rm_rf("#{path_to_repo}/refs/tmp/#{random_string}")
rugged.references.delete(tmp_ref)
end
def fetch_ref(source_path, source_ref, target_ref)
......
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