summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-12-20 21:25:15 +0000
committerRobert Speicher <robert@gitlab.com>2017-12-20 21:25:15 +0000
commit95c5d0d92ba5633b710b501ab64548789cbe4601 (patch)
tree0ff75c3a0a0426745449a0d1fde3b7f2249e4d45 /lib
parente0a27ee419b55509204ba2bfbdbfbab3c7c331bc (diff)
parent28fba5ed99c6f8b4e7e534f9c2046d1c5ab38607 (diff)
downloadgitlab-ce-95c5d0d92ba5633b710b501ab64548789cbe4601.tar.gz
Merge branch 'revert-b655a4a7' into 'master'41349-add-browser-performance-testing-to-auto-devops-docs
Revert "Move Repository#write_ref to Git::Repository#write_ref" Closes #41143 [ci skip] See merge request gitlab-org/gitlab-ce!16055
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git/repository.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 848a782446a..044c60caa05 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1101,17 +1101,12 @@ module Gitlab
end
end
- def write_ref(ref_path, ref, force: false)
+ def write_ref(ref_path, ref)
raise ArgumentError, "invalid ref_path #{ref_path.inspect}" if ref_path.include?(' ')
raise ArgumentError, "invalid ref #{ref.inspect}" if ref.include?("\x00")
- ref = "refs/heads/#{ref}" unless ref.start_with?("refs") || ref =~ /\A[a-f0-9]+\z/i
-
- rugged.references.create(ref_path, ref, force: force)
- rescue Rugged::ReferenceError => ex
- raise GitError, "could not create ref #{ref_path}: #{ex}"
- rescue Rugged::OSError => ex
- raise GitError, "could not create ref #{ref_path}: #{ex}"
+ input = "update #{ref_path}\x00#{ref}\x00\x00"
+ run_git!(%w[update-ref --stdin -z]) { |stdin| stdin.write(input) }
end
def fetch_ref(source_repository, source_ref:, target_ref:)