From 6294b29af7ac25ee584aa893f4dd9a61e2a887e9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 7 Jan 2020 11:20:30 +0800 Subject: [PATCH 1/6] =?UTF-8?q?git=E7=89=88=E6=9C=AC=E5=BA=93=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index de69bf033..01898b980 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -16,7 +16,7 @@ class ShixunsController < ApplicationController :propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec, :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, - :add_file, :jupyter_exec] + :add_file, :jupyter_exec, :upload_git_file, :delete_git_file, :upload_git_file] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public, :upload_git_folder, :shixun_members_added, :change_manager, :collaborators_delete, :upload_git_file, From 462d2afd64ba6e03ab50d193240ea20c9138549a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 7 Jan 2020 11:33:34 +0800 Subject: [PATCH 2/6] 1 --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 01898b980..a2645e77c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1097,7 +1097,7 @@ private else @shixun.try(:repo_path) end - logger.info("######{@repo_path}") + logger.info("#####repo_path: #{@repo_path}") @path = params[:path] end From 88263ec87b77c63312fa3ee4291da7c2700e6ec6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 7 Jan 2020 11:40:00 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index a2645e77c..f98567e3f 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -16,7 +16,7 @@ class ShixunsController < ApplicationController :propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec, :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, - :add_file, :jupyter_exec, :upload_git_file, :delete_git_file, :upload_git_file] + :add_file, :jupyter_exec, :upload_git_file, :delete_git_file, :upload_git_folder] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public, :upload_git_folder, :shixun_members_added, :change_manager, :collaborators_delete, :upload_git_file, @@ -1097,8 +1097,10 @@ private else @shixun.try(:repo_path) end - logger.info("#####repo_path: #{@repo_path}") @path = params[:path] + Rails.logger.info("#####repo_path: #{@repo_path}") + Rails.logger.info("#####repo_path: #{@path}") + end def allowed From 9e405d02152ac5a8969ac8fe09cb20ebf6d7ad33 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 7 Jan 2020 11:43:32 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/git_helper.rb | 10 ++++++---- app/controllers/shixuns_controller.rb | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index d8479d458..e72f1f5da 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -53,13 +53,15 @@ module GitHelper end # 添加目录 - 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) + def git_add_folder(repo_path, folder_path, author_name, author_email, message) + GitService.add_tree(repo_path: repo_path, 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) + def git_delete_file(repo_path, file_path, author_name, author_email, message) + GitService.delete_file(repo_path, repo_path, file_path: file_path, message: message, author_name: author_name, + author_email: author_email) end # 版本库Fork功能 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f98567e3f..f2104bb1f 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -905,7 +905,7 @@ class ShixunsController < ApplicationController author_name = current_user.real_name author_email = current_user.git_mail message = params[:message] || "upload folder by browser" - git_add_folder(@path, author_name, author_email, message) + git_add_folder(@repo_path, @path, author_name, author_email, message) render_ok end @@ -913,7 +913,7 @@ class ShixunsController < ApplicationController author_name = current_user.real_name author_email = current_user.git_mail message = params[:message] || "delete file by browser" - git_delete_file(@path, author_name, author_email, message) + git_delete_file(@repo_path, @path, author_name, author_email, message) render_ok end From 210f7a210f219be52764da5177d8a48c81e13ebb Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 7 Jan 2020 11:47:24 +0800 Subject: [PATCH 5/6] 1 --- app/controllers/shixuns_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f2104bb1f..9f63f311d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1095,11 +1095,12 @@ private @repo_path = if params[:secret_repository] @shixun.shixun_secret_repository&.repo_path else - @shixun.try(:repo_path) + @shixun.repo_path end @path = params[:path] + Rails.logger.info("#####shixun: #{@shixun.repo_path}") Rails.logger.info("#####repo_path: #{@repo_path}") - Rails.logger.info("#####repo_path: #{@path}") + Rails.logger.info("#####path: #{@path}") end From 5202469215f2d01fb89d9a5307f35d554734f207 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 7 Jan 2020 11:51:06 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 9f63f311d..cf30b15a1 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1098,10 +1098,6 @@ private @shixun.repo_path end @path = params[:path] - Rails.logger.info("#####shixun: #{@shixun.repo_path}") - Rails.logger.info("#####repo_path: #{@repo_path}") - Rails.logger.info("#####path: #{@path}") - end def allowed