Permalink
Browse files

Add squash option to merge command

  • Loading branch information...
1 parent 33eaee5 commit 5f8ddfca482a62021b3ca23a7961214b986601a5 @kmnk committed Jul 10, 2013
Showing with 15 additions and 2 deletions.
  1. +6 −1 autoload/giti/merge.vim
  2. +9 −1 test/autoload/giti/test_merge.vim
View
@@ -15,9 +15,14 @@ function! giti#merge#run(param)"{{{
return
endif
+ let squash = ''
+ if exists('a:param.squash') && a:param.squash is 1
+ let squash = '--squash'
+ endif
+
let branch_name = a:param.branch_name
return giti#system_with_specifics({
-\ 'command' : printf('merge %s', branch_name)
+\ 'command' : printf('merge %s %s', squash, branch_name)
\ })
endfunction"}}}
@@ -9,10 +9,18 @@ function! s:tc.test_run()"{{{
call self.assert_equal(giti#merge#run({'branch_name' : 'hoge'}),
\ 'mocked_system_with_specifics')
call self.assert_equal(b:system_with_specifics_called_with, {
-\ 'command' : 'merge hoge'
+\ 'command' : 'merge hoge'
\ })
+
+ call self.assert_equal(giti#merge#run({'branch_name' : 'hoge', 'squash' : 1}),
+\ 'mocked_system_with_specifics')
+ call self.assert_equal(b:system_with_specifics_called_with, {
+\ 'command' : 'merge --squash hoge'
+\ })
+
call self.assert_throw('branch_name required',
\ 'call giti#merge#run({})')
+
call self.assert_throw('E118', 'call giti#merge#run("", "")')
call self.assert_throw('E119', 'call giti#merge#run()')
endfunction"}}}

0 comments on commit 5f8ddfc

Please sign in to comment.