Permalink
Browse files

Fix remove error on no branch repository

  • Loading branch information...
1 parent 762c394 commit 73eefb3df054b9c9f3ce65317df8867538ab9b44 @kmnk committed Jan 8, 2013
Showing with 4 additions and 5 deletions.
  1. +4 −5 autoload/giti/branch.vim
View
@@ -22,19 +22,18 @@ endfunction"}}}
function! giti#branch#current_name()"{{{
let current_branch = giti#branch#current()
- return type(current_branch) == type({})
-\ ? current_branch['name']
-\ : 'master'
+ return has_key(current_branch, 'name') ? current_branch['name'] : 'master'
endfunction"}}}
function! giti#branch#current()"{{{
- return remove(filter(
+ let branchs = filter(
\ map(
\ split(giti#system('branch -a'), '\n'),
\ 's:build_branch_data(v:val)'
\ ),
\ 'v:val.is_current'
-\ ), 0)
+\ )
+ return len(branchs) > 0 ? remove(branches, 0) : {}
endfunction"}}}
function! giti#branch#delete(branches)"{{{

0 comments on commit 73eefb3

Please sign in to comment.