return nil if path.nil?
cmd = "#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller --no-merges -n 1 "
cmd << " #{shell_quote rev} " if rev
- cmd << "-- #{path} " unless path.empty?
+ cmd << "-- #{shell_quote path} " unless path.empty?
shellout(cmd) do |io|
begin
id = io.gets.split[1]
cmd << "#{shell_quote(identifier_from + '..')}" if identifier_from
cmd << "#{shell_quote identifier_to}" if identifier_to
cmd << " --since=#{shell_quote(options[:since].strftime("%Y-%m-%d %H:%M:%S"))}" if options[:since]
- cmd << " -- #{path}" if path && !path.empty?
+ cmd << " -- #{shell_quote path}" if path && !path.empty?
shellout(cmd) do |io|
files=[]
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
- assert_equal 7, assigns(:entries).size
+ assert_equal 8, assigns(:entries).size
assert assigns(:entries).detect {|e| e.name == 'images' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'this_is_a_really_long_and_verbose_directory_name' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'sources' && e.kind == 'dir'}
assert assigns(:entries).detect {|e| e.name == 'copied_README' && e.kind == 'file'}
assert assigns(:entries).detect {|e| e.name == 'new_file.txt' && e.kind == 'file'}
assert assigns(:entries).detect {|e| e.name == 'renamed_test.txt' && e.kind == 'file'}
+ assert assigns(:entries).detect {|e| e.name == 'filemane with spaces.txt' && e.kind == 'file'}
end
def test_browse_branch
end
def test_getting_all_revisions
- assert_equal 13, @adapter.revisions('',nil,nil,:all => true).length
+ assert_equal 14, @adapter.revisions('',nil,nil,:all => true).length
end
def test_getting_certain_revisions
assert_equal 1, @adapter.revisions('','899a15d^','899a15d').length
end
+ def test_getting_revisions_with_spaces_in_filename
+ assert_equal 1, @adapter.revisions("filemane with spaces.txt", nil, nil, :all => true).length
+ end
+
def test_annotate
annotate = @adapter.annotate('sources/watchers_controller.rb')
assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
assert_equal "jsmith", annotate.revisions[4].author
end
+ def test_annotate_moved_file
+ annotate = @adapter.annotate('renamed_test.txt')
+ assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
+ assert_equal 2, annotate.lines.size
+ end
+
def test_last_rev
last_rev = @adapter.lastrev("README", "4f26664364207fa8b1af9f8722647ab2d4ac5d43")
assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.scmid
assert_equal "2009-06-24 05:27:38".to_time, last_rev.time
end
- def test_annotate_moved_file
- annotate = @adapter.annotate('renamed_test.txt')
- assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
- assert_equal 2, annotate.lines.size
+ def test_last_rev_with_spaces_in_filename
+ last_rev = @adapter.lastrev("filemane with spaces.txt", "ed5bb786bbda2dee66a2d50faf51429dbc043a7b")
+ assert_equal "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", last_rev.scmid
+ assert_equal "ed5bb786bbda2dee66a2d50faf51429dbc043a7b", last_rev.identifier
+ assert_equal "Felix Schäfer <felix@fachschaften.org>", last_rev.author
+ assert_equal "2010-09-18 19:59:46".to_time, last_rev.time
end
else
puts "Git test repository NOT FOUND. Skipping unit tests !!!"
@repository.fetch_changesets
@repository.reload
- assert_equal 13, @repository.changesets.count
- assert_equal 22, @repository.changes.count
+ assert_equal 14, @repository.changesets.count
+ assert_equal 23, @repository.changes.count
commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
# Remove the 3 latest changesets
@repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy)
@repository.reload
- assert_equal 10, @repository.changesets.count
+ assert_equal 11, @repository.changesets.count
@repository.fetch_changesets
- assert_equal 13, @repository.changesets.count
+ assert_equal 14, @repository.changesets.count
end
else
puts "Git test repository NOT FOUND. Skipping unit tests !!!"