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:
authorSean McGivern <sean@mcgivern.me.uk>2018-02-02 14:58:32 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-02-02 14:58:32 +0300
commit36838a843e99f551c971ec7062327e114c8f0188 (patch)
tree0ee2afe8228f184f7ad28e74d86bff2c5965c4ae /lib
parenta5bb17ffd5d466568c3bcea161bac42123bd3c1e (diff)
parentc63af942e5baf7849a94fa99da8494bcba28e3f8 (diff)
Merge branch 'master' into '3867-port-to-ce'
# Conflicts: # db/schema.rb
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/git.rb1
-rw-r--r--lib/gitlab/git/repository.rb16
-rw-r--r--lib/gitlab/gitaly_client/repository_service.rb13
3 files changed, 28 insertions, 2 deletions
diff --git a/lib/gitlab/git.rb b/lib/gitlab/git.rb
index c77db0f685f..d4e893b881c 100644
--- a/lib/gitlab/git.rb
+++ b/lib/gitlab/git.rb
@@ -6,6 +6,7 @@ module Gitlab
CommandError = Class.new(StandardError)
CommitError = Class.new(StandardError)
+ OSError = Class.new(StandardError)
class << self
include Gitlab::EncodingHelper
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 68b54d28876..f28624ff37a 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1306,7 +1306,15 @@ module Gitlab
# rubocop:enable Metrics/ParameterLists
def write_config(full_path:)
- rugged.config['gitlab.fullpath'] = full_path if full_path.present?
+ return unless full_path.present?
+
+ gitaly_migrate(:write_config) do |is_enabled|
+ if is_enabled
+ gitaly_repository_client.write_config(full_path: full_path)
+ else
+ rugged_write_config(full_path: full_path)
+ end
+ end
end
def gitaly_repository
@@ -1446,6 +1454,10 @@ module Gitlab
end
end
+ def rugged_write_config(full_path:)
+ rugged.config['gitlab.fullpath'] = full_path
+ end
+
def shell_write_ref(ref_path, ref, old_ref)
raise ArgumentError, "invalid ref_path #{ref_path.inspect}" if ref_path.include?(' ')
raise ArgumentError, "invalid ref #{ref.inspect}" if ref.include?("\x00")
@@ -1507,7 +1519,7 @@ module Gitlab
if sparse_checkout_files
# Create worktree without checking out
run_git!(base_args + ['--no-checkout', worktree_path], env: env)
- worktree_git_path = run_git!(%w(rev-parse --git-dir), chdir: worktree_path)
+ worktree_git_path = run_git!(%w(rev-parse --git-dir), chdir: worktree_path).chomp
configure_sparse_checkout(worktree_git_path, sparse_checkout_files)
diff --git a/lib/gitlab/gitaly_client/repository_service.rb b/lib/gitlab/gitaly_client/repository_service.rb
index 7adf32af209..60706b4f0d8 100644
--- a/lib/gitlab/gitaly_client/repository_service.rb
+++ b/lib/gitlab/gitaly_client/repository_service.rb
@@ -219,6 +219,19 @@ module Gitlab
true
end
+
+ def write_config(full_path:)
+ request = Gitaly::WriteConfigRequest.new(repository: @gitaly_repo, full_path: full_path)
+ response = GitalyClient.call(
+ @storage,
+ :repository_service,
+ :write_config,
+ request,
+ timeout: GitalyClient.fast_timeout
+ )
+
+ raise Gitlab::Git::OSError.new(response.error) unless response.error.empty?
+ end
end
end
end