diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 7655f1eb4..f7845d6f1 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -633,9 +633,10 @@ update end (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s - @rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip + # gitlab端获取默认分支 + gitlab_branchs = $g.project(@project.gpid).default_branch + @project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip) @rev_to = params[:rev_to] - unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE) if @repository.branches.blank? raise InvalidRevisionParam