diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-12-09 20:06:19 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-12-09 20:06:19 +0800 |
commit | 5a115671b9d7c22daf8160d7284786d0f8b216cb (patch) | |
tree | 1b2221b74708d402ed18275feb5b9d52c5718a5d /app/models | |
parent | 56f697466d288c3bff16cc270e5cb2c50c9c14c8 (diff) | |
download | gitlab-ce-5a115671b9d7c22daf8160d7284786d0f8b216cb.tar.gz |
Use rugged.references.delete to delete reference
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7237#note_19746468
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 9d554991ab4..389d52f8c0f 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -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) |