Permalink
Browse files

Add commit pattern

  • Loading branch information...
1 parent c2c214a commit d3c0d83073318b5de698d940f7f7b7c24649d28e @kmnk committed Mar 20, 2013
Showing with 10 additions and 0 deletions.
  1. +2 −0 autoload/giti/diff_tree.vim
  2. +8 −0 test/autoload/giti/test_diff_tree.vim
@@ -36,6 +36,8 @@ function! giti#diff_tree#changed_files(param)"{{{
let res = ''
if from == to
let res = giti#system(printf('diff-tree -r --name-only --no-commit-id %s', from))
+ elseif from == ''
+ let res = giti#system(printf('diff-tree -r --name-only --no-commit-id %s', to))
else
let res = giti#system(printf('diff-tree -r --name-only --no-commit-id %s..%s', from, to))
endif
@@ -36,6 +36,14 @@ function! s:tc.test_changed_files()"{{{
call self.assert_equal(b:system_called_with,
\ printf('diff-tree -r --name-only --no-commit-id %s', arg.from))
+ let arg = { 'from' : '', 'to' : 'foo' }
+ call self.assert_equal(
+\ giti#diff_tree#changed_files(arg),
+\ ['hoge', 'fuga', 'piyo']
+\ )
+ call self.assert_equal(b:system_called_with,
+\ printf('diff-tree -r --name-only --no-commit-id %s', arg.to))
+
call self.assert_throw('E119', 'call giti#diff_tree#changed_files()')
call self.assert_throw('E118', 'call giti#diff_tree#changed_files("", "")')
endfunction"}}}

0 comments on commit d3c0d83

Please sign in to comment.