Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance usability for ticgitweb #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/ticgitweb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ def layout(title, content)
%Q(
%html
%head
%title #{title}
%title #{File.basename(Dir.pwd)}:#{title}
%link{:rel => 'stylesheet', :href => '/_stylesheet.css', :type => 'text/css', :media => 'screen'}
%meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}

%body
%h1 #{File.basename(Dir.pwd)} (#{Dir.pwd})
#navigation
%a{:href => '/'} All
%a{:href => '/fs/open'} Open
Expand Down
2 changes: 1 addition & 1 deletion lib/ticgit-ng/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def initialize(git_dir, opts = {})
@git = Git.open(find_repo(git_dir))

begin
git.lib.full_log_commits 1
git.lib.full_log_commits :count => 1
rescue
puts "Git error: please check your git repository, you must have at least one commit in git"
exit 1
Expand Down
58 changes: 58 additions & 0 deletions spec/scalability_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
require File.dirname(__FILE__) + "/spec_helper"

describe TicGitNG::Base do
include TicGitNGSpecHelper

before(:each) do
@path = setup_new_git_repo
@orig_test_opts = test_opts
@ticgitng = TicGitNG.open(@path, @orig_test_opts)
end

after(:each) do
Dir.glob(File.expand_path("~/.ticgit-ng/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("~/.ticgit/-tmp*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
Dir.glob(File.expand_path("/tmp/ticgit-ng-*")).each {|file_name| FileUtils.rm_r(file_name, {:force=>true,:secure=>true}) }
end

it "Should take the same amount of time to init on a large repo as a small one" do
t1_before=0
t1_after=0
t2_before=0
t2_after=0
path1= setup_new_git_repo
Dir.chdir( path1 ) do
#test a small repo
#do this a couple times to make it a bit fairer re caching
10.times do
t1_before=Time.now.to_i
ticgit1=TicGitNG.open( path1, @orig_test_opts )
t1_after=Time.now.to_i
end
end

path2= setup_new_git_repo
Dir.chdir( path2 ) do
#test a large repo
git=Git.open '.'
500.times do |i|
new_file("file_#{i}", "#{rand(9999999)}_#{i}")
git.add "file_#{i}"
git.commit "Added file_#{i}"
end
#do this a couple times to make it fairer re caching
10.times do
t2_before=Time.now.to_i
ticgit2=TicGitNG.open( path2, @orig_test_opts )
t2_after=Time.now.to_i
end
end
#Opening is a simple operation, it should take less than a second in most cases,
#But this test is intended to make sure that the size of the repo does not impact
#the initialization time of TicGit-ng
#FIXME Fix this dirty hack, find out what the proper way to do this is
true.should == ((t1_after-t1_before) < 5)
true.should == ((t2_after-t2_before) < 5)
end

end