mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
fileinfo: rename os_file_info_id_equal
This commit is contained in:
parent
5d074a0aa6
commit
edcc1a9732
@ -2714,7 +2714,7 @@ buf_write (
|
||||
*/
|
||||
if (os_fileinfo_hardlinks(&file_info_old) > 1
|
||||
|| !os_fileinfo_link((char *)fname, &file_info)
|
||||
|| !os_file_info_id_equal(&file_info, &file_info_old)) {
|
||||
|| !os_fileinfo_id_equal(&file_info, &file_info_old)) {
|
||||
backup_copy = TRUE;
|
||||
} else
|
||||
# endif
|
||||
@ -2764,7 +2764,7 @@ buf_write (
|
||||
/* Symlinks. */
|
||||
if ((bkc_flags & BKC_BREAKSYMLINK)
|
||||
&& file_info_link_ok
|
||||
&& !os_file_info_id_equal(&file_info, &file_info_old)) {
|
||||
&& !os_fileinfo_id_equal(&file_info, &file_info_old)) {
|
||||
backup_copy = FALSE;
|
||||
}
|
||||
|
||||
@ -2772,7 +2772,7 @@ buf_write (
|
||||
if ((bkc_flags & BKC_BREAKHARDLINK)
|
||||
&& os_fileinfo_hardlinks(&file_info_old) > 1
|
||||
&& (!file_info_link_ok
|
||||
|| os_file_info_id_equal(&file_info, &file_info_old))) {
|
||||
|| os_fileinfo_id_equal(&file_info, &file_info_old))) {
|
||||
backup_copy = FALSE;
|
||||
}
|
||||
# endif
|
||||
@ -2844,7 +2844,7 @@ buf_write (
|
||||
* link). If we don't check here, we either ruin the file when
|
||||
* copying or erase it after writing.
|
||||
*/
|
||||
if (os_file_info_id_equal(&file_info_new, &file_info_old)) {
|
||||
if (os_fileinfo_id_equal(&file_info_new, &file_info_old)) {
|
||||
free(backup);
|
||||
backup = NULL; /* no backup file to delete */
|
||||
}
|
||||
@ -3203,7 +3203,7 @@ nobackup:
|
||||
/* Don't delete the file when it's a hard or symbolic link. */
|
||||
if ((!newfile && os_fileinfo_hardlinks(&file_info) > 1)
|
||||
|| (os_fileinfo_link((char *)fname, &file_info)
|
||||
&& !os_file_info_id_equal(&file_info, &file_info_old))) {
|
||||
&& !os_fileinfo_id_equal(&file_info, &file_info_old))) {
|
||||
errmsg = (char_u *)_("E166: Can't open linked file for writing");
|
||||
} else
|
||||
#endif
|
||||
@ -4545,7 +4545,7 @@ int vim_rename(char_u *from, char_u *to)
|
||||
// filesystem. In that case go through a temp file name.
|
||||
FileInfo to_info;
|
||||
if (os_fileinfo((char *)to, &to_info)
|
||||
&& os_file_info_id_equal(&from_info, &to_info)) {
|
||||
&& os_fileinfo_id_equal(&from_info, &to_info)) {
|
||||
use_tmp_file = true;
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ bool os_fileinfo_fd(int file_descriptor, FileInfo *file_info)
|
||||
/// Compare the inodes of two FileInfos
|
||||
///
|
||||
/// @return `true` if the two FileInfos represent the same file.
|
||||
bool os_file_info_id_equal(const FileInfo *file_info_1,
|
||||
bool os_fileinfo_id_equal(const FileInfo *file_info_1,
|
||||
const FileInfo *file_info_2)
|
||||
{
|
||||
return file_info_1->stat.st_ino == file_info_2->stat.st_ino
|
||||
|
@ -355,7 +355,7 @@ int len /* buffer size, only used when name gets longer */
|
||||
MAXPATHL - (tail - name) + 1);
|
||||
FileInfo file_info_new;
|
||||
if (os_fileinfo_link((char *)newname, &file_info_new)
|
||||
&& os_file_info_id_equal(&file_info, &file_info_new)) {
|
||||
&& os_fileinfo_id_equal(&file_info, &file_info_new)) {
|
||||
STRCPY(tail, dp->d_name);
|
||||
break;
|
||||
}
|
||||
|
@ -1351,7 +1351,7 @@ void simplify_filename(char_u *filename)
|
||||
*p = saved_char;
|
||||
}
|
||||
|
||||
if (!os_file_info_id_equal(&file_info, &new_file_info)) {
|
||||
if (!os_fileinfo_id_equal(&file_info, &new_file_info)) {
|
||||
do_strip = FALSE;
|
||||
/* We don't disable stripping of later
|
||||
* components since the unstripped path name is
|
||||
|
@ -545,7 +545,7 @@ describe('fs function', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('os_file_info_id_equal', function()
|
||||
describe('os_fileinfo_id_equal', function()
|
||||
it('returns false if file infos represent different files', function()
|
||||
local file_info_1 = file_info_new()
|
||||
local file_info_2 = file_info_new()
|
||||
@ -553,7 +553,7 @@ describe('fs function', function()
|
||||
local path_2 = 'unit-test-directory/test_2.file'
|
||||
assert.is_true((fs.os_fileinfo(path_1, file_info_1)))
|
||||
assert.is_true((fs.os_fileinfo(path_2, file_info_2)))
|
||||
assert.is_false((fs.os_file_info_id_equal(file_info_1, file_info_2)))
|
||||
assert.is_false((fs.os_fileinfo_id_equal(file_info_1, file_info_2)))
|
||||
end)
|
||||
|
||||
it('returns true if file infos represent the same file', function()
|
||||
@ -562,7 +562,7 @@ describe('fs function', function()
|
||||
local path = 'unit-test-directory/test.file'
|
||||
assert.is_true((fs.os_fileinfo(path, file_info_1)))
|
||||
assert.is_true((fs.os_fileinfo(path, file_info_2)))
|
||||
assert.is_true((fs.os_file_info_id_equal(file_info_1, file_info_2)))
|
||||
assert.is_true((fs.os_fileinfo_id_equal(file_info_1, file_info_2)))
|
||||
end)
|
||||
|
||||
it('returns true if file infos represent the same file (symlink)', function()
|
||||
@ -572,7 +572,7 @@ describe('fs function', function()
|
||||
local path_2 = 'unit-test-directory/test_link.file'
|
||||
assert.is_true((fs.os_fileinfo(path_1, file_info_1)))
|
||||
assert.is_true((fs.os_fileinfo(path_2, file_info_2)))
|
||||
assert.is_true((fs.os_file_info_id_equal(file_info_1, file_info_2)))
|
||||
assert.is_true((fs.os_fileinfo_id_equal(file_info_1, file_info_2)))
|
||||
end)
|
||||
end)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user