BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
37d7e762
Commit
37d7e762
authored
Oct 02, 2017
by
Robert Speicher
Committed by
Jarka Kadlecova
Oct 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch 'sh-fix-import-repos' into 'master'
Fix gitlab-rake gitlab:import:repos task Closes #37682 See merge request gitlab-org/gitlab-ce!14597
parent
c6ae33a6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
3 deletions
+31
-3
project.rb
app/models/project.rb
+4
-2
sh-fix-import-repos.yml
changelogs/unreleased/sh-fix-import-repos.yml
+5
-0
bare_repository_importer.rb
lib/gitlab/bare_repository_importer.rb
+2
-1
project_spec.rb
spec/models/project_spec.rb
+11
-0
create_service_spec.rb
spec/services/projects/create_service_spec.rb
+9
-0
No files found.
app/models/project.rb
View file @
37d7e762
...
...
@@ -72,6 +72,7 @@ class Project < ActiveRecord::Base
attr_accessor
:old_path_with_namespace
attr_accessor
:template_name
attr_writer
:pipeline_status
attr_accessor
:skip_disk_validation
alias_attribute
:title
,
:name
...
...
@@ -227,7 +228,7 @@ class Project < ActiveRecord::Base
validates
:import_url
,
importable_url:
true
,
if:
[
:external_import?
,
:import_url_changed?
]
validates
:star_count
,
numericality:
{
greater_than_or_equal_to:
0
}
validate
:check_limit
,
on: :create
validate
:c
an_create_repository?
,
on:
[
:create
,
:update
],
if:
->
(
project
)
{
!
project
.
persisted?
||
project
.
renamed?
}
validate
:c
heck_repository_path_availability
,
on:
[
:create
,
:update
],
if:
->
(
project
)
{
!
project
.
persisted?
||
project
.
renamed?
}
validate
:avatar_type
,
if:
->
(
project
)
{
project
.
avatar
.
present?
&&
project
.
avatar_changed?
}
validates
:avatar
,
file_size:
{
maximum:
200
.
kilobytes
.
to_i
}
...
...
@@ -1015,7 +1016,8 @@ class Project < ActiveRecord::Base
end
# Check if repository already exists on disk
def
can_create_repository?
def
check_repository_path_availability
return
true
if
skip_disk_validation
return
false
unless
repository_storage_path
expires_full_path_cache
# we need to clear cache to validate renames correctly
...
...
changelogs/unreleased/sh-fix-import-repos.yml
0 → 100644
View file @
37d7e762
---
title
:
Fix gitlab-rake gitlab:import:repos task failing
merge_request
:
author
:
type
:
fixed
lib/gitlab/bare_repository_importer.rb
View file @
37d7e762
...
...
@@ -56,7 +56,8 @@ module Gitlab
name:
project_path
,
path:
project_path
,
repository_storage:
storage_name
,
namespace_id:
group
&
.
id
namespace_id:
group
&
.
id
,
skip_disk_validation:
true
}
project
=
Projects
::
CreateService
.
new
(
user
,
project_params
).
execute
...
...
spec/models/project_spec.rb
View file @
37d7e762
...
...
@@ -2717,6 +2717,17 @@ describe Project do
end
end
describe
'#check_repository_path_availability'
do
let
(
:project
)
{
build
(
:project
)
}
it
'skips gitlab-shell exists?'
do
project
.
skip_disk_validation
=
true
expect
(
project
.
gitlab_shell
).
not_to
receive
(
:exists?
)
expect
(
project
.
check_repository_path_availability
).
to
be_truthy
end
end
describe
'#latest_successful_pipeline_for_default_branch'
do
let
(
:project
)
{
build
(
:project
)
}
...
...
spec/services/projects/create_service_spec.rb
View file @
37d7e762
...
...
@@ -208,6 +208,15 @@ describe Projects::CreateService, '#execute' do
end
end
context
'when skip_disk_validation is used'
do
it
'sets the project attribute'
do
opts
[
:skip_disk_validation
]
=
true
project
=
create_project
(
user
,
opts
)
expect
(
project
.
skip_disk_validation
).
to
be_truthy
end
end
def
create_project
(
user
,
opts
)
Projects
::
CreateService
.
new
(
user
,
opts
).
execute
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment