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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
4f0a38f1
Commit
4f0a38f1
authored
Oct 21, 2015
by
Jeroen Nijhof
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added housekeeping for git repositories
parent
323b6eb1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
0 deletions
+54
-0
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+8
-0
app/services/projects/housekeeping_service.rb
app/services/projects/housekeeping_service.rb
+22
-0
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+11
-0
config/routes.rb
config/routes.rb
+1
-0
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+12
-0
No files found.
app/controllers/projects_controller.rb
View file @
4f0a38f1
...
@@ -171,6 +171,14 @@ class ProjectsController < ApplicationController
...
@@ -171,6 +171,14 @@ class ProjectsController < ApplicationController
end
end
end
end
def
housekeeping
::
Projects
::
HousekeepingService
.
new
(
@project
).
execute
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_path
(
@project
)
}
end
end
def
toggle_star
def
toggle_star
current_user
.
toggle_star
(
@project
)
current_user
.
toggle_star
(
@project
)
@project
.
reload
@project
.
reload
...
...
app/services/projects/housekeeping_service.rb
0 → 100644
View file @
4f0a38f1
# Projects::HousekeepingService class
#
# Used for git housekeeping
#
# Ex.
# Projects::HousekeepingService.new(project, user).execute
#
module
Projects
class
HousekeepingService
<
BaseService
include
Gitlab
::
ShellAdapter
def
initialize
(
project
)
@project
=
project
end
def
execute
if
gitlab_shell
.
exists?
(
@project
.
path_with_namespace
+
'.git'
)
gitlab_shell
.
gc
(
@project
.
path_with_namespace
)
end
end
end
end
app/views/projects/edit.html.haml
View file @
4f0a38f1
...
@@ -141,6 +141,17 @@
...
@@ -141,6 +141,17 @@
-
else
-
else
.nothing-here-block
Only the project owner can archive a project
.nothing-here-block
Only the project owner can archive a project
.panel.panel-default.panel.panel-warning
.panel-heading
Housekeeping
.errors-holder
.panel-body
%p
Runs a number of housekeeping tasks within the current repository,
such as compressing file revisions and removing unreachable objects.
%br
=
link_to
'Housekeeping'
,
housekeeping_namespace_project_path
(
@project
.
namespace
,
@project
),
method: :post
,
class:
"btn btn-warning"
.panel.panel-default.panel.panel-warning
.panel.panel-default.panel.panel-warning
.panel-heading
Rename repository
.panel-heading
Rename repository
.errors-holder
.errors-holder
...
...
config/routes.rb
View file @
4f0a38f1
...
@@ -381,6 +381,7 @@ Gitlab::Application.routes.draw do
...
@@ -381,6 +381,7 @@ Gitlab::Application.routes.draw do
delete
:remove_fork
delete
:remove_fork
post
:archive
post
:archive
post
:unarchive
post
:unarchive
post
:housekeeping
post
:toggle_star
post
:toggle_star
post
:markdown_preview
post
:markdown_preview
get
:autocomplete_sources
get
:autocomplete_sources
...
...
lib/gitlab/backend/shell.rb
View file @
4f0a38f1
...
@@ -149,6 +149,18 @@ module Gitlab
...
@@ -149,6 +149,18 @@ module Gitlab
"
#{
path
}
.git"
,
tag_name
])
"
#{
path
}
.git"
,
tag_name
])
end
end
# Gc repository
#
# path - project path with namespace
#
# Ex.
# gc("gitlab/gitlab-ci")
#
def
gc
(
path
)
Gitlab
::
Utils
.
system_silent
([
gitlab_shell_projects_path
,
'gc'
,
"
#{
path
}
.git"
])
end
# Add new key to gitlab-shell
# Add new key to gitlab-shell
#
#
# Ex.
# Ex.
...
...
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