Append -- to git checkout commands

Checking out a branch or tag may not succeed if there is a path entry
with the same name. This commit appends -- to git checkout commands to
clarify that we're not referring to a file or a directory.

Close #602
This commit is contained in:
Junegunn Choi
2017-02-26 03:34:59 +09:00
parent e3252aae2c
commit 769192d3d0
4 changed files with 20 additions and 5 deletions

View File

@@ -341,3 +341,16 @@ Execute (#593 Add plugin to &rtp before running post-update hook with : prefix):
call plug#end()
PlugInstall!
AssertEqual ['a', 'b'], g:bar
**********************************************************************
Execute (#602 Confusion with branch name and path name):
call plug#begin()
Plug expand('file:////tmp/vim-plug-test/new-branch'), { 'branch': 'plugin' }
call plug#end()
PlugUpdate
call PlugStatusSorted()
Expect:
- new-branch: OK
Finished. 0 error(s).
[=]

View File

@@ -95,6 +95,8 @@ DOC
echo 'let g:foo = 1' > plugin/foo.vim
git add plugin/foo.vim
git commit -m initial
git checkout -b plugin
git checkout master
cd "$BASE"
}

View File

@@ -1473,7 +1473,7 @@ Execute (Commit hash support):
PlugUpdate
Log getline(1, '$')
AssertEqual 'x goyo.vim:', getline(5)
AssertEqual ' error: pathspec ''ffffffff'' did not match any file(s) known to git.', getline(6)
AssertEqual ' fatal: invalid reference: ffffffff', getline(6)
AssertEqual 0, stridx(getline(7), '- vim-emoji: HEAD is now at 9db7fcf...')
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]