Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
88 lines
2.9 KiB
Plaintext
88 lines
2.9 KiB
Plaintext
Describe gina#action#index
|
|
Before all
|
|
let Path = vital#gina#import('System.Filepath')
|
|
let slit = Slit(tempname(), 1)
|
|
call slit.write('A/foo.txt', ['foo'])
|
|
call slit.write('B/foo.txt', ['foo'])
|
|
call slit.write('C/foo.txt', ['foo'])
|
|
call slit.write('D/foo.txt', ['foo'])
|
|
call slit.write('E/foo.txt', ['foo'])
|
|
call slit.write('F/foo.txt', ['foo'])
|
|
if !has('win32') && !has('win64')
|
|
call slit.write('G/<Plug>_', ['foo'])
|
|
endif
|
|
|
|
call slit.execute('add %s', slit.path('A/foo.txt'))
|
|
call slit.execute('commit --quiet -m "First"')
|
|
call slit.execute('add %s', slit.path('B/foo.txt'))
|
|
call slit.execute('commit --quiet -m "Second"')
|
|
call slit.execute('add %s', slit.path('C/foo.txt'))
|
|
call slit.execute('commit --quiet -m "Thrid"')
|
|
" Edit C/foo.txt
|
|
call slit.write('C/foo.txt', ['foobar'])
|
|
End
|
|
|
|
After all
|
|
%bwipeout!
|
|
End
|
|
|
|
Before
|
|
%bwipeout!
|
|
execute 'edit' fnameescape(slit.worktree)
|
|
call gina#action#attach([])
|
|
call gina#action#include('index')
|
|
End
|
|
|
|
Describe 'discard' action
|
|
It checkouts and overwrite the modification on tracked files
|
|
Assert Equals(readfile(slit.path('C/foo.txt')), ['foobar'])
|
|
call gina#action#call('index:discard:force', [
|
|
\ { 'path': slit.path('C/foo.txt'), 'sign': ' M' },
|
|
\])
|
|
call gina#process#wait()
|
|
Assert Equals(readfile(slit.path('C/foo.txt')), ['foo'])
|
|
End
|
|
|
|
It deletes untracked files
|
|
Assert True(filereadable(slit.path('D/foo.txt')))
|
|
call gina#action#call('index:discard:force', [
|
|
\ { 'path': slit.path('D/foo.txt'), 'sign': '!!' },
|
|
\])
|
|
Assert False(filereadable(slit.path('D/foo.txt')))
|
|
End
|
|
|
|
It cannot delete directories for safety
|
|
Assert True(isdirectory(slit.path('E')))
|
|
call gina#action#call('index:discard:force', [
|
|
\ { 'path': slit.path('E'), 'sign': '!!' },
|
|
\])
|
|
Assert True(isdirectory(slit.path('E')))
|
|
End
|
|
|
|
It can delete directories if g:gina#action#index#discard_directories = 1
|
|
let g:gina#action#index#discard_directories = 1
|
|
Assert True(isdirectory(slit.path('F')))
|
|
call gina#action#call('index:discard:force', [
|
|
\ { 'path': slit.path('F'), 'sign': '!!' },
|
|
\])
|
|
Assert False(isdirectory(slit.path('F')))
|
|
unlet g:gina#action#index#discard_directories
|
|
End
|
|
|
|
It can handle <Plug>_ correctly (Issue #133)
|
|
if has('win32') || has('win64')
|
|
Skip Windows filesystem does not allow < or > in path
|
|
endif
|
|
Assert True(filereadable(slit.path('G/<Plug>_')))
|
|
call gina#action#call('index:discard:force', [
|
|
\ { 'path': slit.path('G/<Plug>_'), 'sign': '!!' },
|
|
\])
|
|
Assert False(filereadable(slit.path('G/<Plug>_')))
|
|
Assert True(filereadable(slit.path('A/foo.txt')))
|
|
Assert True(filereadable(slit.path('B/foo.txt')))
|
|
Assert True(filereadable(slit.path('C/foo.txt')))
|
|
End
|
|
End
|
|
End
|
|
|