mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	Merge pull request #4670 from equalsraf/tb-remove-unix-guard
Remove old UNIX ifdef from buf_write()
This commit is contained in:
		| @@ -2688,7 +2688,6 @@ buf_write ( | |||||||
|     } else if ((bkc & BKC_AUTO)) {          /* "auto" */ |     } else if ((bkc & BKC_AUTO)) {          /* "auto" */ | ||||||
|       int i; |       int i; | ||||||
|  |  | ||||||
| # ifdef UNIX |  | ||||||
|       /* |       /* | ||||||
|        * Don't rename the file when: |        * Don't rename the file when: | ||||||
|        * - it's a hard link |        * - it's a hard link | ||||||
| @@ -2699,9 +2698,7 @@ buf_write ( | |||||||
|           || !os_fileinfo_link((char *)fname, &file_info) |           || !os_fileinfo_link((char *)fname, &file_info) | ||||||
|           || !os_fileinfo_id_equal(&file_info, &file_info_old)) { |           || !os_fileinfo_id_equal(&file_info, &file_info_old)) { | ||||||
|         backup_copy = TRUE; |         backup_copy = TRUE; | ||||||
|       } else |       } else { | ||||||
| # endif |  | ||||||
|       { |  | ||||||
|         /* |         /* | ||||||
|          * Check if we can create a file and set the owner/group to |          * Check if we can create a file and set the owner/group to | ||||||
|          * the ones from the original file. |          * the ones from the original file. | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								test/functional/ex_cmds/write_spec.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								test/functional/ex_cmds/write_spec.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | -- Specs for :write | ||||||
|  |  | ||||||
|  | local helpers = require('test.functional.helpers') | ||||||
|  | local eq, eval, clear, write_file, execute, source = | ||||||
|  | 	helpers.eq, helpers.eval, helpers.clear, helpers.write_file, | ||||||
|  | 	helpers.execute, helpers.source | ||||||
|  |  | ||||||
|  | describe(':write', function() | ||||||
|  |   it('&backupcopy=auto preserves symlinks', function() | ||||||
|  |     clear('set backupcopy=auto') | ||||||
|  |     os.remove('test_bkc_file.txt') | ||||||
|  |     os.remove('test_bkc_link.txt') | ||||||
|  |     write_file('test_bkc_file.txt', 'content0') | ||||||
|  |     execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt") | ||||||
|  |     source([[ | ||||||
|  |       edit test_bkc_link.txt | ||||||
|  |       call setline(1, ['content1']) | ||||||
|  |       write | ||||||
|  |     ]]) | ||||||
|  |     eq(eval("['content1']"), eval("readfile('test_bkc_file.txt')")) | ||||||
|  |     eq(eval("['content1']"), eval("readfile('test_bkc_link.txt')")) | ||||||
|  |   end) | ||||||
|  |  | ||||||
|  |   it('&backupcopy=no replaces symlink with new file', function() | ||||||
|  |     clear('set backupcopy=no') | ||||||
|  |     os.remove('test_bkc_file.txt') | ||||||
|  |     os.remove('test_bkc_link.txt') | ||||||
|  |     write_file('test_bkc_file.txt', 'content0') | ||||||
|  |     execute("silent !ln -s test_bkc_file.txt test_bkc_link.txt") | ||||||
|  |     source([[ | ||||||
|  |       edit test_bkc_link.txt | ||||||
|  |       call setline(1, ['content1']) | ||||||
|  |       write | ||||||
|  |     ]]) | ||||||
|  |     eq(eval("['content0']"), eval("readfile('test_bkc_file.txt')")) | ||||||
|  |     eq(eval("['content1']"), eval("readfile('test_bkc_link.txt')")) | ||||||
|  |   end) | ||||||
|  | end) | ||||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes