diff options
author | Robert Speicher <robert@gitlab.com> | 2018-01-10 19:13:50 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-01-10 19:13:50 +0000 |
commit | 4fc0a0901791cd385e38fb437d167e65847fb015 (patch) | |
tree | 91939f7017af3bc3f6721dc9135be03d48f260ee /app/models | |
parent | 968430fe8c4eaa1de5799d9e629375c3bbe38853 (diff) | |
parent | 657065b73eb7253d60c9a63c74a75c0f9c3085ca (diff) | |
download | gitlab-ce-4fc0a0901791cd385e38fb437d167e65847fb015.tar.gz |
Merge branch 'git-write-ref-prep' into 'master'
Gitlab::Git::Repository#write_ref client-prep take 2
Closes gitaly#793
See merge request gitlab-org/gitlab-ce!16287
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | app/models/repository.rb | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index fbe65e700a4..7dc5e980c1b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1149,7 +1149,7 @@ class Project < ActiveRecord::Base def change_head(branch) if repository.branch_exists?(branch) repository.before_change_head - repository.write_ref('HEAD', "refs/heads/#{branch}") + repository.raw_repository.write_ref('HEAD', "refs/heads/#{branch}", shell: false) repository.copy_gitattributes(branch) repository.after_change_head reload_default_branch diff --git a/app/models/repository.rb b/app/models/repository.rb index b36e756c07c..a84d6a1426b 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -260,7 +260,7 @@ class Repository # This will still fail if the file is corrupted (e.g. 0 bytes) begin - write_ref(keep_around_ref_name(sha), sha) + raw_repository.write_ref(keep_around_ref_name(sha), sha, shell: false) rescue Rugged::ReferenceError => ex Rails.logger.error "Unable to create #{REF_KEEP_AROUND} reference for repository #{path}: #{ex}" rescue Rugged::OSError => ex @@ -274,10 +274,6 @@ class Repository ref_exists?(keep_around_ref_name(sha)) end - def write_ref(ref_path, sha) - rugged.references.create(ref_path, sha, force: true) - end - def diverging_commit_counts(branch) root_ref_hash = raw_repository.commit(root_ref).id cache.fetch(:"diverging_commit_counts_#{branch.name}") do |