Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cf37d623
Commit
cf37d623
authored
Aug 30, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed `enable_lfs` to `lfs_enabled` for the Project field, and related fixes.
parent
63a97c11
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
43 additions
and
30 deletions
+43
-30
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+8
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-2
app/models/project.rb
app/models/project.rb
+2
-2
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+2
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+5
-3
db/migrate/20160823213309_add_lfs_enabled_to_projects.rb
db/migrate/20160823213309_add_lfs_enabled_to_projects.rb
+2
-2
db/schema.rb
db/schema.rb
+1
-1
doc/api/projects.md
doc/api/projects.md
+3
-3
doc/workflow/project_features.md
doc/workflow/project_features.md
+5
-5
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+7
-5
spec/requests/lfs_http_spec.rb
spec/requests/lfs_http_spec.rb
+4
-4
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
cf37d623
...
@@ -311,6 +311,14 @@ a.deploy-project-label {
...
@@ -311,6 +311,14 @@ a.deploy-project-label {
color
:
$gl-success
;
color
:
$gl-success
;
}
}
.lfs-enabled
{
color
:
$gl-success
;
}
.lfs-disabled
{
color
:
$gl-warning
;
}
.breadcrumb.repo-breadcrumb
{
.breadcrumb.repo-breadcrumb
{
padding
:
0
;
padding
:
0
;
background
:
transparent
;
background
:
transparent
;
...
...
app/controllers/projects_controller.rb
View file @
cf37d623
...
@@ -309,7 +309,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -309,7 +309,7 @@ class ProjectsController < Projects::ApplicationController
:issues_tracker_id
,
:default_branch
,
:issues_tracker_id
,
:default_branch
,
:wiki_enabled
,
:visibility_level
,
:import_url
,
:last_activity_at
,
:namespace_id
,
:avatar
,
:wiki_enabled
,
:visibility_level
,
:import_url
,
:last_activity_at
,
:namespace_id
,
:avatar
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:builds_enabled
,
:build_allow_git_fetch
,
:build_timeout_in_minutes
,
:build_coverage_regex
,
:public_builds
,
:only_allow_merge_if_build_succeeds
,
:request_access_enabled
,
:
enable_lfs
:public_builds
,
:only_allow_merge_if_build_succeeds
,
:request_access_enabled
,
:
lfs_enabled
)
)
end
end
...
...
app/helpers/projects_helper.rb
View file @
cf37d623
...
@@ -189,11 +189,11 @@ module ProjectsHelper
...
@@ -189,11 +189,11 @@ module ProjectsHelper
def
project_lfs_status
(
project
)
def
project_lfs_status
(
project
)
if
project
.
lfs_enabled?
if
project
.
lfs_enabled?
content_tag
(
:span
,
class:
'
vs-private
'
)
do
content_tag
(
:span
,
class:
'
lfs-enabled
'
)
do
'Enabled'
'Enabled'
end
end
else
else
content_tag
(
:span
,
class:
'
vs-internal
'
)
do
content_tag
(
:span
,
class:
'
lfs-disabled
'
)
do
'Disabled'
'Disabled'
end
end
end
end
...
...
app/models/project.rb
View file @
cf37d623
...
@@ -392,9 +392,9 @@ class Project < ActiveRecord::Base
...
@@ -392,9 +392,9 @@ class Project < ActiveRecord::Base
def
lfs_enabled?
def
lfs_enabled?
return
false
unless
Gitlab
.
config
.
lfs
.
enabled
return
false
unless
Gitlab
.
config
.
lfs
.
enabled
return
Gitlab
.
config
.
lfs
.
enabled
if
enable_lfs
.
nil?
return
Gitlab
.
config
.
lfs
.
enabled
if
self
[
:lfs_enabled
]
.
nil?
enable_lfs
self
[
:lfs_enabled
]
end
end
def
repository_storage_path
def
repository_storage_path
...
...
app/views/admin/projects/show.html.haml
View file @
cf37d623
...
@@ -75,9 +75,10 @@
...
@@ -75,9 +75,10 @@
=
last_commit
(
@project
)
=
last_commit
(
@project
)
%li
%li
%span
.light
LFS status:
%span
.light
Git
LFS status:
%strong
%strong
=
project_lfs_status
(
@project
)
=
project_lfs_status
(
@project
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
-
else
-
else
%li
%li
%span
.light
repository:
%span
.light
repository:
...
...
app/views/projects/edit.html.haml
View file @
cf37d623
...
@@ -83,11 +83,13 @@
...
@@ -83,11 +83,13 @@
-
if
Gitlab
.
config
.
lfs
.
enabled
&&
current_user
.
admin?
-
if
Gitlab
.
config
.
lfs
.
enabled
&&
current_user
.
admin?
.form-group
.form-group
.checkbox
.checkbox
=
f
.
label
:
enable_lfs
do
=
f
.
label
:
lfs_enabled
do
=
f
.
check_box
:
enable_lfs
,
checked:
@project
.
lfs_enabled?
=
f
.
check_box
:
lfs_enabled
,
checked:
@project
.
lfs_enabled?
%strong
LFS
%strong
LFS
%br
%br
%span
.descr
Git Large File Storage
%span
.descr
Git Large File Storage
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
-
if
Gitlab
.
config
.
registry
.
enabled
-
if
Gitlab
.
config
.
registry
.
enabled
.form-group
.form-group
.checkbox
.checkbox
...
...
db/migrate/20160823213309_add_
enable_lfs
_to_projects.rb
→
db/migrate/20160823213309_add_
lfs_enabled
_to_projects.rb
View file @
cf37d623
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
# for more information on how to write migrations for GitLab.
class
Add
EnableLfs
ToProjects
<
ActiveRecord
::
Migration
class
Add
LfsEnabled
ToProjects
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
# Set this constant to true if this migration requires downtime.
...
@@ -24,6 +24,6 @@ class AddEnableLfsToProjects < ActiveRecord::Migration
...
@@ -24,6 +24,6 @@ class AddEnableLfsToProjects < ActiveRecord::Migration
# disable_ddl_transaction!
# disable_ddl_transaction!
def
change
def
change
add_column
:projects
,
:
enable_lfs
,
:boolean
add_column
:projects
,
:
lfs_enabled
,
:boolean
end
end
end
end
db/schema.rb
View file @
cf37d623
...
@@ -825,7 +825,7 @@ ActiveRecord::Schema.define(version: 20160824103857) do
...
@@ -825,7 +825,7 @@ ActiveRecord::Schema.define(version: 20160824103857) do
t
.
string
"repository_storage"
,
default:
"default"
,
null:
false
t
.
string
"repository_storage"
,
default:
"default"
,
null:
false
t
.
boolean
"request_access_enabled"
,
default:
true
,
null:
false
t
.
boolean
"request_access_enabled"
,
default:
true
,
null:
false
t
.
boolean
"has_external_wiki"
t
.
boolean
"has_external_wiki"
t
.
boolean
"
enable_lfs
"
t
.
boolean
"
lfs_enabled
"
end
end
add_index
"projects"
,
[
"ci_id"
],
name:
"index_projects_on_ci_id"
,
using: :btree
add_index
"projects"
,
[
"ci_id"
],
name:
"index_projects_on_ci_id"
,
using: :btree
...
...
doc/api/projects.md
View file @
cf37d623
...
@@ -452,7 +452,7 @@ Parameters:
...
@@ -452,7 +452,7 @@ Parameters:
-
`import_url`
(optional)
-
`import_url`
(optional)
-
`public_builds`
(optional)
-
`public_builds`
(optional)
-
`only_allow_merge_if_build_succeeds`
(optional)
-
`only_allow_merge_if_build_succeeds`
(optional)
-
`
enable_lfs
`
(optional)
-
`
lfs_enabled
`
(optional)
### Create project for user
### Create project for user
...
@@ -479,7 +479,7 @@ Parameters:
...
@@ -479,7 +479,7 @@ Parameters:
-
`import_url`
(optional)
-
`import_url`
(optional)
-
`public_builds`
(optional)
-
`public_builds`
(optional)
-
`only_allow_merge_if_build_succeeds`
(optional)
-
`only_allow_merge_if_build_succeeds`
(optional)
-
`
enable_lfs
`
(optional)
-
`
lfs_enabled
`
(optional)
### Edit project
### Edit project
...
@@ -507,7 +507,7 @@ Parameters:
...
@@ -507,7 +507,7 @@ Parameters:
-
`visibility_level`
(optional)
-
`visibility_level`
(optional)
-
`public_builds`
(optional)
-
`public_builds`
(optional)
-
`only_allow_merge_if_build_succeeds`
(optional)
-
`only_allow_merge_if_build_succeeds`
(optional)
-
`
enable_lfs
`
(optional)
-
`
lfs_enabled
`
(optional)
On success, method returns 200 with the updated project. If parameters are
On success, method returns 200 with the updated project. If parameters are
invalid, 400 is returned.
invalid, 400 is returned.
...
...
doc/workflow/project_features.md
View file @
cf37d623
...
@@ -32,12 +32,12 @@ Snippets are little bits of code or text.
...
@@ -32,12 +32,12 @@ Snippets are little bits of code or text.
This is a nice place to put code or text that is used semi-regularly within the project, but does not belong in source control.
This is a nice place to put code or text that is used semi-regularly within the project, but does not belong in source control.
For example, a specific config file that is used by
>
the team that is only valid for the people that work on the code.
For example, a specific config file that is used by the team that is only valid for the people that work on the code.
## LFS
##
Git
LFS
>**Note:** Project
specific LFS setting was added on 8.12 and is available only to admins.
>**Note:** Project
-
specific LFS setting was added on 8.12 and is available only to admins.
Git Large File Storage allows you to easily manage large binary files with Git.
Git Large File Storage allows you to easily manage large binary files with Git.
With this setting admins can
keep better control of which projects are allowed
With this setting admins can
better control which projects are allowed to use
to use LFS, thus allowing for better storage usage control
.
LFS
.
lib/api/entities.rb
View file @
cf37d623
...
@@ -78,7 +78,7 @@ module API
...
@@ -78,7 +78,7 @@ module API
expose
:path
,
:path_with_namespace
expose
:path
,
:path_with_namespace
expose
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:builds_enabled
,
:snippets_enabled
,
:container_registry_enabled
expose
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:builds_enabled
,
:snippets_enabled
,
:container_registry_enabled
expose
:created_at
,
:last_activity_at
expose
:created_at
,
:last_activity_at
expose
:shared_runners_enabled
,
:
enable_lfs
expose
:shared_runners_enabled
,
:
lfs_enabled
expose
:creator_id
expose
:creator_id
expose
:namespace
expose
:namespace
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
expose
:forked_from_project
,
using:
Entities
::
BasicProjectDetails
,
if:
lambda
{
|
project
,
options
|
project
.
forked?
}
...
...
lib/api/projects.rb
View file @
cf37d623
...
@@ -105,7 +105,7 @@ module API
...
@@ -105,7 +105,7 @@ module API
# visibility_level (optional) - 0 by default
# visibility_level (optional) - 0 by default
# import_url (optional)
# import_url (optional)
# public_builds (optional)
# public_builds (optional)
#
enable_lfs
(optional)
#
lfs_enabled
(optional)
# Example Request
# Example Request
# POST /projects
# POST /projects
post
do
post
do
...
@@ -126,7 +126,7 @@ module API
...
@@ -126,7 +126,7 @@ module API
:import_url
,
:import_url
,
:public_builds
,
:public_builds
,
:only_allow_merge_if_build_succeeds
,
:only_allow_merge_if_build_succeeds
,
:
enable_lfs
]
:
lfs_enabled
]
attrs
=
map_public_to_visibility_level
(
attrs
)
attrs
=
map_public_to_visibility_level
(
attrs
)
@project
=
::
Projects
::
CreateService
.
new
(
current_user
,
attrs
).
execute
@project
=
::
Projects
::
CreateService
.
new
(
current_user
,
attrs
).
execute
if
@project
.
saved?
if
@project
.
saved?
...
@@ -158,6 +158,7 @@ module API
...
@@ -158,6 +158,7 @@ module API
# visibility_level (optional)
# visibility_level (optional)
# import_url (optional)
# import_url (optional)
# public_builds (optional)
# public_builds (optional)
# lfs_enabled (optional)
# Example Request
# Example Request
# POST /projects/user/:user_id
# POST /projects/user/:user_id
post
"user/:user_id"
do
post
"user/:user_id"
do
...
@@ -176,7 +177,8 @@ module API
...
@@ -176,7 +177,8 @@ module API
:visibility_level
,
:visibility_level
,
:import_url
,
:import_url
,
:public_builds
,
:public_builds
,
:only_allow_merge_if_build_succeeds
]
:only_allow_merge_if_build_succeeds
,
:lfs_enabled
]
attrs
=
map_public_to_visibility_level
(
attrs
)
attrs
=
map_public_to_visibility_level
(
attrs
)
@project
=
::
Projects
::
CreateService
.
new
(
user
,
attrs
).
execute
@project
=
::
Projects
::
CreateService
.
new
(
user
,
attrs
).
execute
if
@project
.
saved?
if
@project
.
saved?
...
@@ -222,7 +224,7 @@ module API
...
@@ -222,7 +224,7 @@ module API
# public (optional) - if true same as setting visibility_level = 20
# public (optional) - if true same as setting visibility_level = 20
# visibility_level (optional) - visibility level of a project
# visibility_level (optional) - visibility level of a project
# public_builds (optional)
# public_builds (optional)
#
enable_lfs
(optional)
#
lfs_enabled
(optional)
# Example Request
# Example Request
# PUT /projects/:id
# PUT /projects/:id
put
':id'
do
put
':id'
do
...
@@ -241,7 +243,7 @@ module API
...
@@ -241,7 +243,7 @@ module API
:visibility_level
,
:visibility_level
,
:public_builds
,
:public_builds
,
:only_allow_merge_if_build_succeeds
,
:only_allow_merge_if_build_succeeds
,
:
enable_lfs
]
:
lfs_enabled
]
attrs
=
map_public_to_visibility_level
(
attrs
)
attrs
=
map_public_to_visibility_level
(
attrs
)
authorize_admin_project
authorize_admin_project
authorize!
:rename_project
,
user_project
if
attrs
[
:name
].
present?
authorize!
:rename_project
,
user_project
if
attrs
[
:name
].
present?
...
...
spec/requests/lfs_http_spec.rb
View file @
cf37d623
...
@@ -69,7 +69,7 @@ describe 'Git LFS API and storage' do
...
@@ -69,7 +69,7 @@ describe 'Git LFS API and storage' do
describe
'LFS disabled in project'
do
describe
'LFS disabled in project'
do
before
do
before
do
project
.
update_attribute
(
:
enable_lfs
,
false
)
project
.
update_attribute
(
:
lfs_enabled
,
false
)
end
end
it
'responds with a 501 message on upload'
do
it
'responds with a 501 message on upload'
do
...
@@ -87,7 +87,7 @@ describe 'Git LFS API and storage' do
...
@@ -87,7 +87,7 @@ describe 'Git LFS API and storage' do
describe
'LFS enabled in project'
do
describe
'LFS enabled in project'
do
before
do
before
do
project
.
update_attribute
(
:
enable_lfs
,
true
)
project
.
update_attribute
(
:
lfs_enabled
,
true
)
end
end
it
'responds with a 501 message on upload'
do
it
'responds with a 501 message on upload'
do
...
@@ -112,7 +112,7 @@ describe 'Git LFS API and storage' do
...
@@ -112,7 +112,7 @@ describe 'Git LFS API and storage' do
describe
'LFS disabled in project'
do
describe
'LFS disabled in project'
do
before
do
before
do
project
.
update_attribute
(
:
enable_lfs
,
false
)
project
.
update_attribute
(
:
lfs_enabled
,
false
)
end
end
it
'responds with a 403 message on upload'
do
it
'responds with a 403 message on upload'
do
...
@@ -132,7 +132,7 @@ describe 'Git LFS API and storage' do
...
@@ -132,7 +132,7 @@ describe 'Git LFS API and storage' do
describe
'LFS enabled in project'
do
describe
'LFS enabled in project'
do
before
do
before
do
project
.
update_attribute
(
:
enable_lfs
,
true
)
project
.
update_attribute
(
:
lfs_enabled
,
true
)
end
end
it
'responds with a 200 message on upload'
do
it
'responds with a 200 message on upload'
do
...
...
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