summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-12-19 14:36:33 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-01-03 16:13:31 -0200
commit9504a529b758b0352b9c60d67fda8b4ee2a5fec0 (patch)
treefb83470abf88a850895e986be4e9c8ba544ec326 /app
parent946a3634bc5a851944e5cc7fe8fdb5341ca5176b (diff)
downloadgitlab-ce-9504a529b758b0352b9c60d67fda8b4ee2a5fec0.tar.gz
Write project full path to .git/config when creating projects
We'd need to keep track of project full path otherwise directory tree created with hashed storage enabled cannot be usefully imported using the import rake task.
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb5
-rw-r--r--app/services/projects/create_service.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 6ebb083aeb4..eac78de1ac9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1432,6 +1432,11 @@ class Project < ActiveRecord::Base
Gitlab::PagesTransfer.new.rename_project(path_before_change, self.path, namespace.full_path)
end
+ def write_repository_config(key, value, prefix: :gitlab)
+ key = [prefix, key].compact.join('.')
+ repo.config[key] = value
+ end
+
def rename_repo_notify!
send_move_instructions(full_path_was)
expires_full_path_cache
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index dc7b1f1f5cc..4c7e5370bbe 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -87,6 +87,11 @@ module Projects
def after_create_actions
log_info("#{@project.owner.name} created a new project \"#{@project.name_with_namespace}\"")
+ # We'd need to keep track of project full path otherwise directory tree
+ # created with hashed storage enabled cannot be usefully imported using
+ # the import rake task.
+ @project.write_repository_config(:fullpath, @project.full_path)
+
unless @project.gitlab_project_import?
@project.create_wiki unless skip_wiki?
create_services_from_active_templates(@project)