patch 8.0.1704: 'backupskip' default doesn't work for Mac
Problem: 'backupskip' default doesn't work for Mac.
Solution: Use "/private/tmp". (Rainer Müller, closes #2793)
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 93efaec..cc19e25 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1087,7 +1087,9 @@
< 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|
diff --git a/src/option.c b/src/option.c
index 48432bb..5ef346c 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3367,7 +3367,11 @@
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);
diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim
index 5d2033a..0f2908f 100644
--- a/src/testdir/test_options.vim
+++ b/src/testdir/test_options.vim
@@ -332,3 +332,19 @@
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
diff --git a/src/version.c b/src/version.c
index fdaa1dc..8d7049d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1704,
+/**/
1703,
/**/
1702,