diff options
author | Robert Speicher <robert@gitlab.com> | 2017-12-20 21:25:15 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-12-20 21:25:15 +0000 |
commit | 95c5d0d92ba5633b710b501ab64548789cbe4601 (patch) | |
tree | 0ff75c3a0a0426745449a0d1fde3b7f2249e4d45 /lib | |
parent | e0a27ee419b55509204ba2bfbdbfbab3c7c331bc (diff) | |
parent | 28fba5ed99c6f8b4e7e534f9c2046d1c5ab38607 (diff) | |
download | gitlab-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.rb | 11 |
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:) |