From 9cfb2c2a19cd545f53e2587d51db24f2cde38b16 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 19 Jul 2019 23:36:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E5=A6=82=E6=9E=9C=E6=B2=A1=E8=BF=81=E7=A7=BB=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index ecbf603b0..5c432baa0 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -489,7 +489,13 @@ class GamesController < ApplicationController path = path.try(:strip) uid_logger("--rep_content: path is #{path}") begin - @content = git_fle_content(@myshixun.repo_path, path) || "" + if @myshixun.repo_name.nil? + g = Gitlab.client + repo_name = g.project(@myshixun.gpid).path_with_namespace + @myshixun.update_column(:repo_name, repo_name) + end + + @content = git_fle_content("#{repo_name}.git", path) || "" rescue Exception => e # 思路: 异常首先应该考虑去恢复 if params[:retry].to_i == 1 From 80f4c8f6ba7561c023b28aea4e71ec0ff6c64318 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 19 Jul 2019 23:41:18 +0800 Subject: [PATCH 2/2] repo content --- app/controllers/games_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 5c432baa0..ec69f3963 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -493,9 +493,11 @@ class GamesController < ApplicationController g = Gitlab.client repo_name = g.project(@myshixun.gpid).path_with_namespace @myshixun.update_column(:repo_name, repo_name) + @content = git_fle_content("#{repo_name}.git", path) || "" + else + @content = git_fle_content(@myshixun.repo_path, path) || "" end - @content = git_fle_content("#{repo_name}.git", path) || "" rescue Exception => e # 思路: 异常首先应该考虑去恢复 if params[:retry].to_i == 1