Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
4f0a38f1
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4f0a38f1
编写于
10月 21, 2015
作者:
J
Jeroen Nijhof
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added housekeeping for git repositories
上级
323b6eb1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
0 deletion
+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
未找到文件。
app/controllers/projects_controller.rb
浏览文件 @
4f0a38f1
...
...
@@ -171,6 +171,14 @@ class ProjectsController < ApplicationController
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
current_user
.
toggle_star
(
@project
)
@project
.
reload
...
...
app/services/projects/housekeeping_service.rb
0 → 100644
浏览文件 @
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
浏览文件 @
4f0a38f1
...
...
@@ -141,6 +141,17 @@
-
else
.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-heading
Rename repository
.errors-holder
...
...
config/routes.rb
浏览文件 @
4f0a38f1
...
...
@@ -381,6 +381,7 @@ Gitlab::Application.routes.draw do
delete
:remove_fork
post
:archive
post
:unarchive
post
:housekeeping
post
:toggle_star
post
:markdown_preview
get
:autocomplete_sources
...
...
lib/gitlab/backend/shell.rb
浏览文件 @
4f0a38f1
...
...
@@ -149,6 +149,18 @@ module Gitlab
"
#{
path
}
.git"
,
tag_name
])
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
#
# Ex.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录