mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.0251: support full paths for 'backupdir' #11269
Problem: Using a full path is supported for 'directory' but not for
'backupdir'. (Mikolaj Machowski)
Solution: Support 'backupdir' as well. (Christian Brabandt, closes vim/vim#179)
b782ba475a
This commit is contained in:
committed by
Justin M. Keyes
parent
b1c4a8191e
commit
1ff5b60cb9
@@ -9,9 +9,12 @@ local nvim_prog = helpers.nvim_prog
|
||||
local request = helpers.request
|
||||
local retry = helpers.retry
|
||||
local rmdir = helpers.rmdir
|
||||
local mkdir = helpers.mkdir
|
||||
local sleep = helpers.sleep
|
||||
local read_file = helpers.read_file
|
||||
local trim = helpers.trim
|
||||
local currentdir = helpers.funcs.getcwd
|
||||
local iswin = helpers.iswin
|
||||
|
||||
describe('fileio', function()
|
||||
before_each(function()
|
||||
@@ -24,6 +27,7 @@ describe('fileio', function()
|
||||
os.remove('Xtest_startup_file2')
|
||||
os.remove('Xtest_тест.md')
|
||||
rmdir('Xtest_startup_swapdir')
|
||||
rmdir('Xtest_backupdir')
|
||||
end)
|
||||
|
||||
it('fsync() codepaths #8304', function()
|
||||
@@ -88,6 +92,27 @@ describe('fileio', function()
|
||||
eq('foo', bar_contents);
|
||||
end)
|
||||
|
||||
it('backup with full path #11214', function()
|
||||
clear()
|
||||
mkdir('Xtest_backupdir')
|
||||
command('set backup')
|
||||
command('set backupdir=Xtest_backupdir//')
|
||||
command('write Xtest_startup_file1')
|
||||
feed('ifoo<esc>')
|
||||
command('write')
|
||||
feed('Abar<esc>')
|
||||
command('write')
|
||||
|
||||
-- Backup filename = fullpath, separators replaced with "%".
|
||||
local backup_file_name = string.gsub(currentdir()..'/Xtest_startup_file1',
|
||||
iswin() and '[:/\\]' or '/', '%%') .. '~'
|
||||
local foo_contents = trim(read_file('Xtest_backupdir/'..backup_file_name))
|
||||
local foobar_contents = trim(read_file('Xtest_startup_file1'))
|
||||
|
||||
eq('foobar', foobar_contents);
|
||||
eq('foo', foo_contents);
|
||||
end)
|
||||
|
||||
it('readfile() on multibyte filename #10586', function()
|
||||
clear()
|
||||
local text = {
|
||||
|
||||
Reference in New Issue
Block a user