File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,8 @@ module Git
3
3
class Base
4
4
5
5
module Factory
6
-
7
6
# @return [Git::Branch] an object for branch_name
8
- def branch ( branch_name = 'master' )
7
+ def branch ( branch_name = self . current_branch )
9
8
Git ::Branch . new ( self , branch_name )
10
9
end
11
10
@@ -93,7 +92,6 @@ def merge_base(*args)
93
92
shas = self . lib . merge_base ( *args )
94
93
shas . map { |sha | gcommit ( sha ) }
95
94
end
96
-
97
95
end
98
96
99
97
end
Original file line number Diff line number Diff line change @@ -14,6 +14,18 @@ def setup
14
14
@branches = @git . branches
15
15
end
16
16
17
+ test 'Git::Lib#branch with no args should return current branch' do
18
+ in_temp_dir do
19
+ git = Git . init ( '.' , initial_branch : 'my_branch' )
20
+ File . write ( 'file.txt' , 'hello world' )
21
+ git . add ( 'file.txt' )
22
+ git . commit ( 'Initial commit' )
23
+
24
+ b = git . branch
25
+ assert_equal ( 'my_branch' , b . name )
26
+ end
27
+ end
28
+
17
29
def test_branches_all
18
30
assert ( @git . branches [ :master ] . is_a? ( Git ::Branch ) )
19
31
assert ( @git . branches . size > 5 )
You can’t perform that action at this time.
0 commit comments