File tree 2 files changed +30
-0
lines changed 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -772,6 +772,7 @@ def checkout_file(version, file)
772
772
773
773
def merge ( branch , message = nil , opts = { } )
774
774
arr_opts = [ ]
775
+ arr_opts << '--no-commit' if opts [ :no_commit ]
775
776
arr_opts << '--no-ff' if opts [ :no_ff ]
776
777
arr_opts << '-m' << message if message
777
778
arr_opts += [ branch ]
Original file line number Diff line number Diff line change @@ -130,4 +130,33 @@ def test_no_ff_merge
130
130
end
131
131
end
132
132
end
133
+
134
+ def test_merge_no_commit
135
+ in_temp_dir do |path |
136
+ g = Git . clone ( @wbare , 'branch_merge_test' )
137
+ g . chdir do
138
+ g . branch ( 'new_branch_1' ) . in_branch ( 'first commit message' ) do
139
+ new_file ( 'new_file_1' , 'foo' )
140
+ g . add
141
+ true
142
+ end
143
+
144
+ g . branch ( 'new_branch_2' ) . in_branch ( 'first commit message' ) do
145
+ new_file ( 'new_file_2' , 'bar' )
146
+ g . add
147
+ true
148
+ end
149
+
150
+ g . checkout ( 'new_branch_2' )
151
+ before_merge = g . show
152
+ g . merge ( 'new_branch_1' , nil , no_commit : true )
153
+ # HEAD is the same as before.
154
+ assert_equal ( before_merge , g . show )
155
+ # File has not been merged in.
156
+ status = g . status [ 'new_file_1' ]
157
+ assert_equal ( 'new_file_1' , status . path )
158
+ assert_equal ( 'A' , status . type )
159
+ end
160
+ end
161
+ end
133
162
end
You can’t perform that action at this time.
0 commit comments