summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-08-11 20:12:17 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-08-11 20:12:17 +0800
commitca685f80e0fffa60827fe0da7cff1192cef701de (patch)
tree85b199835f9b7fa25afe59c8d45de7b3a5a2ce06
parent501be36c2e3e5c0191e68d23df0f330100bbb8be (diff)
downloadgitlab-ce-ca685f80e0fffa60827fe0da7cff1192cef701de.tar.gz
Since now fetch_ref is reliable, we could just rely on it
-rw-r--r--app/models/repository.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 04403cdd035..a761302b06b 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -989,12 +989,10 @@ class Repository
if start_repository == self
start_branch_name
else
- tmp_ref = "refs/tmp/#{SecureRandom.hex}/head"
-
- fetch_ref(
+ tmp_ref = fetch_ref(
start_repository.path_to_repo,
"#{Gitlab::Git::BRANCH_REF_PREFIX}#{start_branch_name}",
- tmp_ref
+ "refs/tmp/#{SecureRandom.hex}/head"
)
start_repository.commit(start_branch_name).sha
@@ -1003,7 +1001,7 @@ class Repository
yield(commit(branch_name_or_sha))
ensure
- rugged.references.delete(tmp_ref) if tmp_ref && ref_exists?(tmp_ref)
+ rugged.references.delete(tmp_ref) if tmp_ref
end
def add_remote(name, url)
@@ -1029,6 +1027,8 @@ class Repository
# Make sure ref was created, and raise Rugged::ReferenceError when not
raise Rugged::ReferenceError, message if status != 0
+
+ target_ref
end
def create_ref(ref, ref_path)