From f35acd764b65f22ba641f58175fe5e7929edab9e Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 6 Apr 2012 19:57:45 -0400 Subject: [PATCH] Support password authentication --- plugin/rhubarb.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugin/rhubarb.vim b/plugin/rhubarb.vim index 737370f..d8abb7f 100644 --- a/plugin/rhubarb.vim +++ b/plugin/rhubarb.vim @@ -38,13 +38,23 @@ function! s:credentials() let g:github_user = $LOGNAME endif endif - if !exists('g:github_token') + if !exists('g:github_password') + let g:github_password = $GITHUB_PASSWORD + if g:github_password ==# '' + let g:github_password = system('git config --get github.password')[0:-2] + endif + endif + if !exists('g:github_token') && g:github_password ==# '' let g:github_token = $GITHUB_TOKEN if g:github_token ==# '' let g:github_token = system('git config --get github.token')[0:-2] endif endif - return g:github_user.'/token:'.g:github_token + if exists('g:github_token') && g:github_token !=# '' + return g:github_user.'/token:'.g:github_token + else + return g:github_user.':'.g:github_password + endif endfunction function! rhubarb#json_parse(string)