diff options
author | Sato Hiroyuki <sathiroyuki@gmail.com> | 2013-01-29 17:25:17 +0900 |
---|---|---|
committer | Sato Hiroyuki <sathiroyuki@gmail.com> | 2013-01-30 09:12:03 +0900 |
commit | 525a8cd3e96b7bae0acda8b6e94df529fa06ff6a (patch) | |
tree | dbfda7c6ee03274470c2176c7c19dc396fc4ac5a /lib | |
parent | c84675ee06dfc72c46c178ef40e30f03053dcc5a (diff) | |
download | gitlab-ce-525a8cd3e96b7bae0acda8b6e94df529fa06ff6a.tar.gz |
Switchable the main branch on network graph
Diffstat (limited to 'lib')
-rw-r--r-- | lib/extracts_path.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/graph/json_builder.rb | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb index 12700e4f4ac..976ac018204 100644 --- a/lib/extracts_path.rb +++ b/lib/extracts_path.rb @@ -54,9 +54,10 @@ module ExtractsPath input.gsub!(/^#{Gitlab.config.gitlab.relative_url_root}/, "") # Remove project, actions and all other staff from path input.gsub!(/^\/#{Regexp.escape(@project.path_with_namespace)}/, "") - input.gsub!(/^\/(tree|commits|blame|blob|refs)\//, "") # remove actions + input.gsub!(/^\/(tree|commits|blame|blob|refs|graph)\//, "") # remove actions input.gsub!(/\?.*$/, "") # remove stamps suffix input.gsub!(/.atom$/, "") # remove rss feed + input.gsub!(/.json$/, "") # remove json suffix input.gsub!(/\/edit$/, "") # remove edit route part if input.match(/^([[:alnum:]]{40})(.+)/) diff --git a/lib/gitlab/graph/json_builder.rb b/lib/gitlab/graph/json_builder.rb index a3157aa4b4d..5a2f27fc1af 100644 --- a/lib/gitlab/graph/json_builder.rb +++ b/lib/gitlab/graph/json_builder.rb @@ -9,8 +9,9 @@ module Gitlab @max_count ||= 650 end - def initialize project + def initialize project, ref @project = project + @ref = ref @repo = project.repo @ref_cache = {} @@ -66,9 +67,9 @@ module Gitlab heads.select!{|h| h.is_a? Grit::Head or h.is_a? Grit::Remote} # sort heads so the master is top and current branches are closer heads.sort! do |a,b| - if a.name == "master" + if a.name == @ref -1 - elsif b.name == "master" + elsif b.name == @ref 1 else b.commit.committed_date <=> a.commit.committed_date |