Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKim Carlbäcker <kim.carlbacker@gmail.com>2017-12-20 21:29:52 +0300
committerKim Carlbäcker <kim.carlbacker@gmail.com>2017-12-20 21:29:52 +0300
commit28fba5ed99c6f8b4e7e534f9c2046d1c5ab38607 (patch)
tree2b4437f2a4a5584e937ece43507431a254d2bec6 /lib
parentf5290c9738bbca7b130ddc86c0cdcc3f35e34c3a (diff)
Revert "Merge branch 'repo-write-ref-client-prep' into 'master'"
This reverts merge request !15712
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:)