Patch 8.0.1819
Problem:    Swap file warning for a file in a non-existing directory, if there
            is another with the same file name. (Juergen Weigert)
Solution:   When expanding the file name fails compare the file names.
Files:      src/testdir/test_swap.vim, src/memline.c


*** ../vim-8.0.1818/src/testdir/test_swap.vim   2017-11-04 22:36:47.331496337 
+0100
--- src/testdir/test_swap.vim   2018-05-12 15:57:33.846942876 +0200
***************
*** 82,84 ****
--- 82,99 ----
      call delete('Xtest')
    endtry
  endfunc
+ 
+ func Test_missing_dir()
+   call mkdir('Xswapdir')
+   exe 'set directory=' . getcwd() . '/Xswapdir'
+ 
+   call assert_equal('', glob('foo'))
+   call assert_equal('', glob('bar'))
+   edit foo/x.txt
+   " This should not give a warning for an existing swap file.
+   split bar/x.txt
+   only
+ 
+   set directory&
+   call delete('Xswapdir', 'rf')
+ endfunc
*** ../vim-8.0.1818/src/memline.c       2018-04-10 18:47:16.093527046 +0200
--- src/memline.c       2018-05-12 16:51:22.985147144 +0200
***************
*** 4648,4655 ****
   *            == 0   == 0     OK      FAIL    TRUE
   *
   * current file doesn't exist, inode for swap unknown, both file names not
!  * available -> probably same file
!  *            == 0   == 0    FAIL     FAIL    FALSE
   *
   * Note that when the ino_t is 64 bits, only the last 32 will be used.  This
   * can't be changed without making the block 0 incompatible with 32 bit
--- 4648,4655 ----
   *            == 0   == 0     OK      FAIL    TRUE
   *
   * current file doesn't exist, inode for swap unknown, both file names not
!  * available -> compare file names
!  *            == 0   == 0    FAIL     FAIL    fname_c != fname_s
   *
   * Note that when the ino_t is 64 bits, only the last 32 will be used.  This
   * can't be changed without making the block 0 incompatible with 32 bit
***************
*** 4693,4706 ****
      retval_c = vim_FullName(fname_c, buf_c, MAXPATHL, TRUE);
      retval_s = vim_FullName(fname_s, buf_s, MAXPATHL, TRUE);
      if (retval_c == OK && retval_s == OK)
!       return (STRCMP(buf_c, buf_s) != 0);
  
      /*
       * Can't compare inodes or file names, guess that the files are different,
!      * unless both appear not to exist at all.
       */
      if (ino_s == 0 && ino_c == 0 && retval_c == FAIL && retval_s == FAIL)
!       return FALSE;
      return TRUE;
  }
  #endif /* CHECK_INODE */
--- 4693,4707 ----
      retval_c = vim_FullName(fname_c, buf_c, MAXPATHL, TRUE);
      retval_s = vim_FullName(fname_s, buf_s, MAXPATHL, TRUE);
      if (retval_c == OK && retval_s == OK)
!       return STRCMP(buf_c, buf_s) != 0;
  
      /*
       * Can't compare inodes or file names, guess that the files are different,
!      * unless both appear not to exist at all, then compare with the file name
!      * in the swap file.
       */
      if (ino_s == 0 && ino_c == 0 && retval_c == FAIL && retval_s == FAIL)
!       return STRCMP(fname_c, fname_s) != 0;
      return TRUE;
  }
  #endif /* CHECK_INODE */
*** ../vim-8.0.1818/src/version.c       2018-05-12 16:55:10.543668881 +0200
--- src/version.c       2018-05-12 16:59:23.622083563 +0200
***************
*** 763,764 ****
--- 763,766 ----
  {   /* Add new patch number below this line */
+ /**/
+     1819,
  /**/

-- 
An indication you must be a manager:
You feel sorry for Dilbert's boss.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui