瀏覽代碼

Use `git::` prefix to avoid password prompt on git 1.7 (#56)

Junegunn Choi 11 年之前
父節點
當前提交
da24f714e0
共有 2 個文件被更改,包括 10 次插入10 次删除
  1. 4 4
      plug.vim
  2. 6 6
      test/workflow.vader

+ 4 - 4
plug.vim

@@ -379,7 +379,7 @@ function! s:infer_properties(name, repo)
       if repo !~ '/'
         let repo = 'vim-scripts/'. repo
       endif
-      let uri = 'https://git:@github.com/' . repo . '.git'
+      let uri = 'https://git::@github.com/' . repo . '.git'
     endif
     let dir = s:dirpath( fnamemodify(join([g:plug_home, a:name], '/'), ':p') )
     return { 'dir': dir, 'uri': uri }
@@ -870,7 +870,7 @@ function! s:update_parallel(pull, todo, threads)
                 else
                   [false, [data.chomp, "PlugClean required."].join($/)]
                 end
-              elsif current_uri.sub(/git:@/, '') != uri.sub(/git:@/, '')
+              elsif current_uri.sub(/git::?@/, '') != uri.sub(/git::?@/, '')
                 [false, ["Invalid URI: #{current_uri}",
                          "Expected:    #{uri}",
                          "PlugClean required."].join($/)]
@@ -913,8 +913,8 @@ function! s:progress_bar(line, bar, total)
 endfunction
 
 function! s:compare_git_uri(a, b)
-  let a = substitute(a:a, 'git:@', '', '')
-  let b = substitute(a:b, 'git:@', '', '')
+  let a = substitute(a:a, 'git:\{1,2}@', '', '')
+  let b = substitute(a:b, 'git:\{1,2}@', '', '')
   return a ==# b
 endfunction
 

+ 6 - 6
test/workflow.vader

@@ -75,7 +75,7 @@ Execute (Subsequent plug#begin() calls will reuse g:plug_home):
 Execute (Test Plug command):
   " Git repo with branch
   Plug 'junegunn/seoul256.vim', 'yes-t_co'
-  AssertEqual 'https://git:@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
+  AssertEqual 'https://git::@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
   AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
   AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
 
@@ -84,7 +84,7 @@ Execute (Test Plug command):
 
   " Git repo with tag
   Plug 'junegunn/goyo.vim', '1.5.2'
-  AssertEqual 'https://git:@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
+  AssertEqual 'https://git::@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
   AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
   AssertEqual '1.5.2', g:plugs['goyo.vim'].branch
 
@@ -99,7 +99,7 @@ Execute (Test Plug command):
 
   " vim-scripts/
   Plug 'beauty256'
-  AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
+  AssertEqual 'https://git::@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
   AssertEqual 'master', g:plugs.beauty256.branch
 
   AssertEqual 4, len(g:plugs)
@@ -199,8 +199,8 @@ Execute (PlugStatus):
   call PlugStatusSorted()
 
 Expect:
-      Expected:    https://git:@github.com/junegunn.choi/seoul256.vim.git
-      Invalid URI: https://git:@github.com/junegunn/seoul256.vim.git
+      Expected:    https://git::@github.com/junegunn.choi/seoul256.vim.git
+      Invalid URI: https://git::@github.com/junegunn/seoul256.vim.git
       PlugClean required.
   - vim-emoji: OK
   Finished. 1 error(s).
@@ -233,7 +233,7 @@ Execute (PlugStatus):
   call PlugStatusSorted()
 
 Expect:
-      Expected:    https://git:@github.com/junegunn/vim-emoji.git
+      Expected:    https://git::@github.com/junegunn/vim-emoji.git
       Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
       Not found. Try PlugInstall.
       PlugClean required.