| |   |
| 15 | 15 | |
| 16 | 16 | def index |
| 17 | 17 | params[:path] ||= git.make_local_path(git.paths.first) |
| 18 | | params[:limit] ||= git.config["git-tmbundle.log.limit"] || DEFAULT_LOG_LIMIT |
| 19 | 18 | path = params[:path] |
| 20 | 19 | # Get the desired revision number |
| 21 | 20 | if File.directory?(git.git_base + path) |
| … | … | |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | def log |
| 30 | params[:limit] ||= git.config["git-tmbundle.log.limit"] || DEFAULT_LOG_LIMIT |
| 30 | 31 | log_params = params.reject { |key,value| [:controller, :action, :layout].include?(key) } |
| 31 | 32 | @path = params[:path] |
| 32 | 33 | @log_entries = git.log(log_params) |
| toggle raw diff |
--- a/Support/app/controllers/log_controller.rb
+++ b/Support/app/controllers/log_controller.rb
@@ -15,7 +15,6 @@ class LogController < ApplicationController
def index
params[:path] ||= git.make_local_path(git.paths.first)
- params[:limit] ||= git.config["git-tmbundle.log.limit"] || DEFAULT_LOG_LIMIT
path = params[:path]
# Get the desired revision number
if File.directory?(git.git_base + path)
@@ -28,6 +27,7 @@ class LogController < ApplicationController
end
def log
+ params[:limit] ||= git.config["git-tmbundle.log.limit"] || DEFAULT_LOG_LIMIT
log_params = params.reject { |key,value| [:controller, :action, :layout].include?(key) }
@path = params[:path]
@log_entries = git.log(log_params) |
| |   |
| 7 | 7 | before(:each) do |
| 8 | 8 | Git.reset_mock! |
| 9 | 9 | @git = Git.singleton_new |
| 10 | @git.config.stub!(:[]).with("branch.master.remote").and_return("origin") |
| 11 | @git.config.stub!(:[]).with("git-tmbundle.log.limit").and_return(5) |
| 10 | 12 | end |
| 11 | 13 | |
| 12 | 14 | describe "fetching" do |
| 13 | 15 | before(:each) do |
| 14 | 16 | # query the sources |
| 15 | | @git.config.stub!(:[]).with("branch.master.remote").and_return("origin") |
| 16 | 17 | Git.command_response["branch"] = "* master\n" |
| 17 | 18 | Git.command_response["config", "branch.master.remote"] = %Q{origin} |
| 18 | 19 | Git.command_response["remote"] = %Q{origin} |
| 19 | 20 | |
| 20 | 21 | git = Git.singleton_new |
| 21 | | git.should_receive(:log).with({:path=>".", :revisions=>["74c0fdf", "d1c6bdd"]}).and_return(parse_log(fixture_file("log_with_diffs.txt"))) |
| 22 | git.should_receive(:log).with(:path=>".", :revisions=>["74c0fdf", "d1c6bdd"], :limit => 5).and_return(parse_log(fixture_file("log_with_diffs.txt"))) |
| 22 | 23 | |
| 23 | 24 | Git.command_response["fetch", "origin"] = fixture_file("fetch_1_5_4_3_output.txt") |
| 24 | 25 | |
| … | … | |
| 46 | 46 | Git.command_response["branch"] = "* master\n" |
| 47 | 47 | Git.command_response["branch", "-r"] = " origin/master\n origin/release\n" |
| 48 | 48 | @git.config.stub!(:[]).with("remote.origin.fetch").and_return("+refs/heads/*:refs/remotes/origin/*") |
| 49 | | @git.config.stub!(:[]).with("branch.master.remote").and_return('origin') |
| 50 | 49 | @git.config.stub!(:[]).with("branch.master.merge").and_return("refs/heads/master") |
| 51 | 50 | Git.command_response["remote"] = %Q{origin} |
| 52 | 51 | |
| … | … | |
| 89 | 89 | end |
| 90 | 90 | |
| 91 | 91 | it "should run all git commands" do |
| 92 | | Git.commands_ran.should == [["branch"], ["remote"], ["push", "origin", "master"], ["log", "865f920..f9ca10d", "."], ["branch"], ["branch"]] |
| 92 | Git.commands_ran.should == [["branch"], ["remote"], ["push", "origin", "master"], ["log", "-n", 5, "865f920..f9ca10d", "."], ["branch"], ["branch"]] |
| 93 | 93 | end |
| 94 | 94 | |
| 95 | 95 | it "should output log with diffs" do |
| toggle raw diff |
--- a/Support/spec/controllers/remote_controller_spec.rb
+++ b/Support/spec/controllers/remote_controller_spec.rb
@@ -7,18 +7,19 @@ describe RemoteController do
before(:each) do
Git.reset_mock!
@git = Git.singleton_new
+ @git.config.stub!(:[]).with("branch.master.remote").and_return("origin")
+ @git.config.stub!(:[]).with("git-tmbundle.log.limit").and_return(5)
end
describe "fetching" do
before(:each) do
# query the sources
- @git.config.stub!(:[]).with("branch.master.remote").and_return("origin")
Git.command_response["branch"] = "* master\n"
Git.command_response["config", "branch.master.remote"] = %Q{origin}
Git.command_response["remote"] = %Q{origin}
git = Git.singleton_new
- git.should_receive(:log).with({:path=>".", :revisions=>["74c0fdf", "d1c6bdd"]}).and_return(parse_log(fixture_file("log_with_diffs.txt")))
+ git.should_receive(:log).with(:path=>".", :revisions=>["74c0fdf", "d1c6bdd"], :limit => 5).and_return(parse_log(fixture_file("log_with_diffs.txt")))
Git.command_response["fetch", "origin"] = fixture_file("fetch_1_5_4_3_output.txt")
@@ -45,7 +46,6 @@ describe RemoteController do
Git.command_response["branch"] = "* master\n"
Git.command_response["branch", "-r"] = " origin/master\n origin/release\n"
@git.config.stub!(:[]).with("remote.origin.fetch").and_return("+refs/heads/*:refs/remotes/origin/*")
- @git.config.stub!(:[]).with("branch.master.remote").and_return('origin')
@git.config.stub!(:[]).with("branch.master.merge").and_return("refs/heads/master")
Git.command_response["remote"] = %Q{origin}
@@ -89,7 +89,7 @@ describe RemoteController do
end
it "should run all git commands" do
- Git.commands_ran.should == [["branch"], ["remote"], ["push", "origin", "master"], ["log", "865f920..f9ca10d", "."], ["branch"], ["branch"]]
+ Git.commands_ran.should == [["branch"], ["remote"], ["push", "origin", "master"], ["log", "-n", 5, "865f920..f9ca10d", "."], ["branch"], ["branch"]]
end
it "should output log with diffs" do |