Gitlab端获取默认分支

This commit is contained in:
newuser 2016-02-26 15:37:59 +08:00
parent d2bd4706d3
commit 555a9131c4
1 changed files with 3 additions and 2 deletions

View File

@ -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