]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.1704: 'backupskip' default doesn't work for Mac v8.0.1704
authorBram Moolenaar <Bram@vim.org>
Thu, 12 Apr 2018 19:37:34 +0000 (21:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 12 Apr 2018 19:37:34 +0000 (21:37 +0200)
Problem:    'backupskip' default doesn't work for Mac.
Solution:   Use "/private/tmp". (Rainer Müller, closes #2793)

runtime/doc/options.txt
src/option.c
src/testdir/test_options.vim
src/version.c

index 93efaec16dabb1e5a554e83c587bffc1894a2d73..cc19e253def5e81f8792d6b8030add9c1bd34d1c 100644 (file)
@@ -1087,7 +1087,9 @@ A jump table for the options with a short description can be found at |Q_op|.
 <      Use 'backupdir' to put the backup in a different directory.
 
                                                *'backupskip'* *'bsk'*
-'backupskip' 'bsk'     string  (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*")
+'backupskip' 'bsk'     string  (default: "$TMPDIR/*,$TMP/*,$TEMP/*"
+                                Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*"
+                                Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*")
                        global
                        {not in Vi}
                        {not available when compiled without the |+wildignore|
index 48432bb3228f910d7882c7cad59c2f5c29e329ff..5ef346c8d4a1a9e7e62c38b1bde974b5d4f2677e 100644 (file)
@@ -3367,7 +3367,11 @@ set_init_1(int clean_arg)
            mustfree = FALSE;
 # ifdef UNIX
            if (*names[n] == NUL)
+#  ifdef MACOS_X
+               p = (char_u *)"/private/tmp";
+#  else
                p = (char_u *)"/tmp";
+#  endif
            else
 # endif
                p = vim_getenv((char_u *)names[n], &mustfree);
index 5d2033a5dff3556121b2c65a40589eac521ba778..0f2908fcb352dcb1d05b24afeb2600bdd68e320c 100644 (file)
@@ -332,3 +332,19 @@ func Test_set_indentexpr()
   call assert_equal('', &indentexpr)
   bwipe!
 endfunc
+
+func Test_backupskip()
+  if has("mac")
+    call assert_match('/private/tmp/\*', &bsk)
+  elseif has("unix")
+    call assert_match('/tmp/\*', &bsk)
+  endif
+
+  let bskvalue = substitute(&bsk, '\\', '/', 'g')
+  for var in  ['$TEMPDIR', '$TMP', '$TEMP']
+    if exists(var)
+      let varvalue = substitute(expand(var), '\\', '/', 'g')
+      call assert_match(varvalue . '.\*', bskvalue)
+    endif
+  endfor
+endfunc
index fdaa1dc6cc6213121c785c715bb65ae76fe520cc..8d7049d5fd852c2855f8d575c2c9bd4277414f2d 100644 (file)
@@ -762,6 +762,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1704,
 /**/
     1703,
 /**/