diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index e72f1f5da..f80434392 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -53,14 +53,16 @@ module GitHelper end # 添加目录 - 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, + def git_add_folder(repo_path, tree_path, author_name, author_email, message) + Rails.logger.info("#####repo_path:#{repo_path}, tree_path: #{tree_path}") + GitService.add_tree(repo_path: repo_path, tree_path: tree_path, message: message, author_name: author_name, author_email: author_email) end # 删除文件 - 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, + def git_delete_file(repo_path, tree_path, author_name, author_email, message) + Rails.logger.info("#####repo_path:#{repo_path}, tree_path: #{tree_path}") + GitService.delete_file(repo_path: repo_path, tree_path: tree_path, message: message, author_name: author_name, author_email: author_email) end diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index cf30b15a1..4e26475fe 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -896,7 +896,8 @@ class ShixunsController < ApplicationController author_email = current_user.git_mail message = params[:message] || "upload file by browser" uid_logger("-----author_email: #{author_email}") - update_file_base64_content(content, @repo_path, @path, author_email, author_name, message) + path = @path.present? ? "#{@path}/#{upload_file.original_filename}" : "#{upload_file.original_filename}" + update_file_base64_content(content, @repo_path, path, author_email, author_name, message) render_ok end diff --git a/app/services/git_service.rb b/app/services/git_service.rb index eedac2595..dbc4975ec 100644 --- a/app/services/git_service.rb +++ b/app/services/git_service.rb @@ -68,8 +68,8 @@ class GitService content = JSON.parse(body) if content["code"] != 0 - raise("版本库异常") logger.error("repository error: #{content['msg']}") + raise("版本库异常") end #raise content["msg"] if content["code"] != 0