Browse files

Merge branch 'master' of github.com:kmnk/vim-unite-giti

  • Loading branch information...
2 parents a239d75 + b0ffd7c commit ce7d6962650cb9a7b6bb722e417e0c6ec6ce23db @kmnk committed Mar 19, 2013
View
56 README.markdown
@@ -13,34 +13,20 @@
- giti
- view sources of giti
-- giti/status
- - view status of current repository
- giti/branch
- view branches on current repository
-- giti/log
- - view log on current repository
- giti/config
- view config
+- giti/log
+ - view log on current repository
- giti/remote
- view remotes
+- giti/status
+ - view status of current repository
### Kinds
-#### *giti/status* actions
-
-- add
-- rm\_cached
-- reset
-- commit
-- amend
-- checkout
-- diff
-- diff\_cached
-- diff\_head
-- ignore
-
-
#### *giti/branch* actions
- switch
@@ -49,26 +35,43 @@
- merge
+#### *giti/config* actions
+
+- yank\_value
+- write
+- remove
+
+
#### *giti/log* actions
- view
- diff
- revert
+- vimdiff
- reset
-#### *giti/config* actions
-
-- yank\_value
-- write
-- remove
-
-
#### *giti/remote* actions
- fetch
-- rm
- rename
+- rm
+
+
+#### *giti/status* actions
+
+- add
+- add\_patch
+- reset
+- commit
+- amend
+- checkout
+- diff
+- diff\_cached
+- diff\_head
+- vimdiff\_head
+- rm\_cached
+- ignore
### CUSTOM ACTION
@@ -87,7 +90,6 @@
## TODO
- extend *giti/log* source (and write document about it)
-- extend *giti/diff* action (use vimdiff)
- implement *giti/stash* source and kind
- implement *giti/blame* source and kind (use scrollbind)
- implement *giti/tag* source and kind
View
8 autoload/giti/branch.vim
@@ -21,17 +21,19 @@ function! giti#branch#list_all()"{{{
endfunction"}}}
function! giti#branch#current_name()"{{{
- return giti#branch#current()['name']
+ let current_branch = giti#branch#current()
+ return has_key(current_branch, 'name') ? current_branch['name'] : 'master'
endfunction"}}}
function! giti#branch#current()"{{{
- return remove(filter(
+ let branches = filter(
\ map(
\ split(giti#system('branch -a'), '\n'),
\ 's:build_branch_data(v:val)'
\ ),
\ 'v:val.is_current'
-\ ), 0)
+\ )
+ return len(branches) > 0 ? remove(branches, 0) : {}
endfunction"}}}
function! giti#branch#delete(branches)"{{{
View
4 autoload/giti/commit.vim
@@ -17,8 +17,8 @@ function! giti#commit#dry_run(files)"{{{
return s:run('commit --dry-run', a:files)
endfunction"}}}
-function! giti#commit#amend()"{{{
- return s:run('commit --amend', [])
+function! giti#commit#amend(files)"{{{
+ return s:run('commit --amend', a:files)
endfunction"}}}
" local functions {{{
View
8 autoload/unite/kinds/giti/status.vim
@@ -73,7 +73,13 @@ let s:kind.action_table.amend = {
\ 'is_selectable' : 1,
\}
function! s:kind.action_table.amend.func(candidates)"{{{
- return giti#commit#amend()
+ let files = []
+ for candidate in a:candidates
+ for path in candidate.action__paths
+ call add(files, path)
+ endfor
+ endfor
+ return giti#commit#amend(files)
endfunction"}}}
let s:kind.action_table.checkout = {
View
7 test/autoload/giti/test_commit.vim
@@ -34,15 +34,16 @@ endfunction"}}}
function! s:tc.test_amend()"{{{
- call giti#commit#amend()
+ call giti#commit#amend(['hoge', 'fuga'])
call self.assert_equal(
\ b:system_with_specifics_called_with,
\ {
-\ 'command' : 'commit --amend -- ',
+\ 'command' : 'commit --amend -- hoge fuga',
\ 'ignore_error' : 1,
\ }
\ )
- call self.assert_throw('E118', 'call giti#commit#amend("")')
+ call self.assert_throw('E118', 'call giti#commit#amend("", "")')
+ call self.assert_throw('E119', 'call giti#commit#amend()')
endfunction"}}}
unlet s:tc
View
7 test/autoload/unite/kinds/giti/test_status.vim
@@ -126,7 +126,8 @@ function! s:tc.test_kind_action_commit()"{{{
endfunction"}}}
function! s:tc.setup_kind_action_amend()"{{{
- function! giti#commit#amend()"{{{
+ function! giti#commit#amend(param)"{{{
+ let b:commit_amend_called_with = a:param
return 'mocked giti#commit#amend'
endfunction"}}}
endfunction"}}}
@@ -144,6 +145,10 @@ function! s:tc.test_kind_action_amend()"{{{
let candidates = [{ 'action__paths' : [ 'hoge', 'fuga' ] }]
call self.assert_equal('mocked giti#commit#amend', amend.func(candidates))
+ call self.assert_equal([
+\ candidates[0].action__paths[0],
+\ candidates[0].action__paths[1]
+\ ], b:commit_amend_called_with)
endfunction"}}}
function! s:tc.setup_kind_action_checkout()"{{{

0 comments on commit ce7d696

Please sign in to comment.