From a16ad63e191e414aa0e88da8339eaefb6a25eab9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 3 Jan 2020 16:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/git_helper.rb | 7 ++++++- app/controllers/shixuns_controller.rb | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index 7f2024830..0d8604aac 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -46,10 +46,15 @@ module GitHelper end # 添加目录 - def add_git_folder(folder_path, author_name, author_email, message) + def git_add_folder(folder_path, author_name, author_email, message) GitService.add_tree(file_path: folder_path, message: message, author_name: author_name, author_email: author_email) end + # 删除文件 + def git_delete_file(file_path, author_name, author_email, message) + GitService.delete_file(file_path: file_path, message: message, author_name: author_name, author_email: author_email) + end + # 版本库Fork功能 def project_fork(container, original_rep_path, username) raise Educoder::TipException.new("fork源路径为空,fork失败!") if original_rep_path.blank? diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 37c72db97..7b3cb7588 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -901,12 +901,14 @@ class ShixunsController < ApplicationController def upload_git_folder author_name = current_user.real_name author_email = current_user.git_mail - add_git_folder(@path, author_name, author_email, "upload folder by browser") + git_add_folder(@path, author_name, author_email, "upload folder by browser") render_ok end def delete_git_file - + author_name = current_user.real_name + author_email = current_user.git_mail + git_delete_file(@path, author_name, author_email, "delete filer by browser") render_ok end