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
fff5ebdc
Commit
fff5ebdc
authored
Aug 09, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some useless code, codestyle changes and removed an index
parent
95a270c8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7 additions
and
12 deletions
+7
-12
project.rb
app/models/project.rb
+2
-4
hashed_project.rb
app/models/storage/hashed_project.rb
+2
-2
_form.html.haml
app/views/admin/application_settings/_form.html.haml
+1
-1
20170802013652_add_storage_fields_to_project.rb
db/migrate/20170802013652_add_storage_fields_to_project.rb
+0
-2
schema.rb
db/schema.rb
+0
-1
project_spec.rb
spec/models/project_spec.rb
+2
-2
No files found.
app/models/project.rb
View file @
fff5ebdc
...
...
@@ -1432,9 +1432,7 @@ class Project < ActiveRecord::Base
def
storage
@storage
||=
if
!
has_attribute?
(
:storage_version
)
# during migration
Storage
::
LegacyProject
.
new
(
self
)
elsif
self
.
storage_version
&&
self
.
storage_version
>=
1
if
self
.
storage_version
&&
self
.
storage_version
>=
1
Storage
::
HashedProject
.
new
(
self
)
else
Storage
::
LegacyProject
.
new
(
self
)
...
...
@@ -1442,7 +1440,7 @@ class Project < ActiveRecord::Base
end
def
use_hashed_storage
if
!
self
.
persiste
d?
&&
current_application_settings
.
hashed_storage_enabled
if
self
.
new_recor
d?
&&
current_application_settings
.
hashed_storage_enabled
self
.
storage_version
=
LATEST_STORAGE_VERSION
end
end
...
...
app/models/storage/hashed_project.rb
View file @
fff5ebdc
...
...
@@ -11,14 +11,14 @@ module Storage
#
# @return [String] directory where repository is stored
def
base_dir
%Q(
#{
disk_hash
[
0
..
1
]
}
/
#{
disk_hash
[
2
..
3
]
}
)
if
disk_hash
"
#{
disk_hash
[
0
..
1
]
}
/
#{
disk_hash
[
2
..
3
]
}
"
if
disk_hash
end
# Disk path is used to build repository and project's wiki path on disk
#
# @return [String] combination of base_dir and the repository own name without `.git` or `.wiki.git` extensions
def
disk_path
%Q(
#{
base_dir
}
/
#{
disk_hash
}
)
"
#{
base_dir
}
/
#{
disk_hash
}
"
end
def
ensure_storage_path_exist
...
...
app/views/admin/application_settings/_form.html.haml
View file @
fff5ebdc
...
...
@@ -499,7 +499,7 @@
=
f
.
check_box
:hashed_storage_enabled
Create new projects using hashed storage paths
.help-block
Enable immutable, hash
based paths and repository names to store repositories on disk. This prevents
Enable immutable, hash
-
based paths and repository names to store repositories on disk. This prevents
repositories from having to be moved or renamed when the Project URL changes and may improve disk I/O performance.
%em
(EXPERIMENTAL)
.form-group
...
...
db/migrate/20170802013652_add_storage_fields_to_project.rb
View file @
fff5ebdc
...
...
@@ -5,11 +5,9 @@ class AddStorageFieldsToProject < ActiveRecord::Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column
:projects
,
:storage_version
,
:integer
,
limit:
2
add_concurrent_index
:projects
,
:storage_version
end
def
down
...
...
db/schema.rb
View file @
fff5ebdc
...
...
@@ -1226,7 +1226,6 @@ ActiveRecord::Schema.define(version: 20170820100558) do
add_index
"projects"
,
[
"pending_delete"
],
name:
"index_projects_on_pending_delete"
,
using: :btree
add_index
"projects"
,
[
"runners_token"
],
name:
"index_projects_on_runners_token"
,
using: :btree
add_index
"projects"
,
[
"star_count"
],
name:
"index_projects_on_star_count"
,
using: :btree
add_index
"projects"
,
[
"storage_version"
],
name:
"index_projects_on_storage_version"
,
using: :btree
add_index
"projects"
,
[
"visibility_level"
],
name:
"index_projects_on_visibility_level"
,
using: :btree
create_table
"protected_branch_merge_access_levels"
,
force: :cascade
do
|
t
|
...
...
spec/models/project_spec.rb
View file @
fff5ebdc
...
...
@@ -2389,7 +2389,7 @@ describe Project do
subject
{
project
.
rename_repo
}
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
end
end
end
...
...
@@ -2469,7 +2469,7 @@ describe Project do
subject
{
project
.
rename_repo
}
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
it
{
expect
{
subject
}.
to
raise_error
(
StandardError
)
}
end
end
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