Skip to content

Commit dac73b7

Browse files
Supporting arrays for the Log path method. Closes ruby-git#62
Adding some tests for status over dot files
1 parent 77707c2 commit dac73b7

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

lib/git/lib.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ def log_path_options(opts)
747747
arr_opts = []
748748

749749
arr_opts << opts[:object] if opts[:object].is_a? String
750-
arr_opts << '--' << opts[:path_limiter] if opts[:path_limiter].is_a? String
750+
arr_opts << '--' << opts[:path_limiter] if opts[:path_limiter]
751751

752752
arr_opts
753753
end

tests/units/test_log.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ def test_get_log_since_file
6363
l = @git.log.between('v2.5', 'test').path('example.txt')
6464
assert_equal(1, l.size)
6565
end
66+
67+
def test_get_log_path
68+
log = @git.log.path('example.txt')
69+
assert_equal(30, log.size)
70+
log = @git.log.path('example*')
71+
assert_equal(30, log.size)
72+
log = @git.log.path(['example.txt','scott/text.txt'])
73+
assert_equal(30, log.size)
74+
end
6675

6776
def test_log_file_noexist
6877
assert_raise Git::GitExecuteError do

tests/units/test_status.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
#!/usr/bin/env ruby
3+
4+
require File.dirname(__FILE__) + '/../test_helper'
5+
6+
class TestStatus < Test::Unit::TestCase
7+
8+
def setup
9+
set_file_paths
10+
end
11+
12+
def test_dot_files_status
13+
in_temp_dir do |path|
14+
git = Git.clone(@wdir, 'test_dot_files_status')
15+
16+
create_file('test_dot_files_status/test_file_1', 'content tets_file_1')
17+
create_file('test_dot_files_status/.test_file_2', 'content test_file_2')
18+
19+
git.add('test_file_1')
20+
git.add('.test_file_2')
21+
22+
assert(git.status.added.assoc('test_file_1'))
23+
assert(git.status.added.assoc('.test_file_2'))
24+
end
25+
end
26+
27+
end

0 commit comments

Comments
 (0)