From 3a4c1c5c63f625e6e6075d384a85c67c3992ffb7 Mon Sep 17 00:00:00 2001 From: Sato Hiroyuki Date: Fri, 12 Apr 2013 17:49:11 +0900 Subject: [PATCH] Enable to filter graph by ref --- app/controllers/graph_controller.rb | 2 +- app/models/network/graph.rb | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/graph_controller.rb b/app/controllers/graph_controller.rb index 22544ad..c79ed5c 100644 --- a/app/controllers/graph_controller.rb +++ b/app/controllers/graph_controller.rb @@ -16,7 +16,7 @@ class GraphController < ProjectResourceController format.html format.json do - @graph = Network::Graph.new(project, @ref, @commit) + @graph = Network::Graph.new(project, @ref, @commit, @options[:filter_ref]) end end end diff --git a/app/models/network/graph.rb b/app/models/network/graph.rb index 2707283..ffec471 100644 --- a/app/models/network/graph.rb +++ b/app/models/network/graph.rb @@ -8,10 +8,11 @@ module Network @max_count ||= 650 end - def initialize project, ref, commit + def initialize project, ref, commit, filter_ref @project = project @ref = ref @commit = commit + @filter_ref = filter_ref @repo = project.repo @commits = collect_commits @@ -107,7 +108,9 @@ module Network skip: skip } - Grit::Commit.find_all(@repo, nil, opts) + ref = @ref if @filter_ref + + Grit::Commit.find_all(@repo, ref, opts) end def commits_sort_by_ref -- libgit2 0.21.2