Skip to content

Commit b8e22a0

Browse files
committed
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)
1 parent 527dec3 commit b8e22a0

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

runtime/doc/options.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,9 @@ A jump table for the options with a short description can be found at |Q_op|.
10871087
< Use 'backupdir' to put the backup in a different directory.
10881088

10891089
*'backupskip'* *'bsk'*
1090-
'backupskip' 'bsk' string (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*")
1090+
'backupskip' 'bsk' string (default: "$TMPDIR/*,$TMP/*,$TEMP/*"
1091+
Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*"
1092+
Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*")
10911093
global
10921094
{not in Vi}
10931095
{not available when compiled without the |+wildignore|

src/option.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,11 @@ set_init_1(int clean_arg)
33673367
mustfree = FALSE;
33683368
# ifdef UNIX
33693369
if (*names[n] == NUL)
3370+
# ifdef MACOS_X
3371+
p = (char_u *)"/private/tmp";
3372+
# else
33703373
p = (char_u *)"/tmp";
3374+
# endif
33713375
else
33723376
# endif
33733377
p = vim_getenv((char_u *)names[n], &mustfree);

src/testdir/test_options.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,19 @@ func Test_set_indentexpr()
332332
call assert_equal('', &indentexpr)
333333
bwipe!
334334
endfunc
335+
336+
func Test_backupskip()
337+
if has("mac")
338+
call assert_match('/private/tmp/\*', &bsk)
339+
elseif has("unix")
340+
call assert_match('/tmp/\*', &bsk)
341+
endif
342+
343+
let bskvalue = substitute(&bsk, '\\', '/', 'g')
344+
for var in ['$TEMPDIR', '$TMP', '$TEMP']
345+
if exists(var)
346+
let varvalue = substitute(expand(var), '\\', '/', 'g')
347+
call assert_match(varvalue . '.\*', bskvalue)
348+
endif
349+
endfor
350+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static char *(features[]) =
762762

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1704,
765767
/**/
766768
1703,
767769
/**/

0 commit comments

Comments
 (0)