]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.1519: 'backupskip' may contain duplicates v8.1.1519
authorBram Moolenaar <Bram@vim.org>
Wed, 12 Jun 2019 17:05:48 +0000 (19:05 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 12 Jun 2019 17:05:48 +0000 (19:05 +0200)
Problem:    'backupskip' may contain duplicates.
Solution:   Add the P_NODUP flag. (Tom Ryder)

src/option.c
src/testdir/test_options.vim
src/version.c

index 2146be7ef6fb03d74a41556273583319fafa16f6..2d22c4c9735633efc95e86b0a02602ce53162c2d 100644 (file)
@@ -616,7 +616,7 @@ static struct vimoption options[] =
                            (char_u *)"~",
 #endif
                                            (char_u *)0L} SCTX_INIT},
-    {"backupskip",  "bsk",  P_STRING|P_VI_DEF|P_ONECOMMA,
+    {"backupskip",  "bsk",  P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
 #ifdef FEAT_WILDIGN
                            (char_u *)&p_bsk, PV_NONE,
                            {(char_u *)"", (char_u *)0L}
@@ -4807,7 +4807,8 @@ do_set(
                             * hex numbers. */
                            vim_str2nr(arg, NULL, &i, STR2NR_ALL,
                                                     &value, NULL, 0, TRUE);
-                           if (i == 0 || (arg[i] != NUL && !VIM_ISWHITE(arg[i])))
+                           if (i == 0 || (arg[i] != NUL
+                                                     && !VIM_ISWHITE(arg[i])))
                            {
                                errmsg = N_("E521: Number required after =");
                                goto skip;
index 13de719342338ad79cc3d414de4be3fae9789cf3..9d3065d159d6644ac3153c578dc31d0a891a926c 100644 (file)
@@ -419,6 +419,15 @@ func Test_backupskip()
       call assert_true(found, var . ' (' . varvalue . ') not in option bsk: ' . &bsk)
     endif
   endfor
+
+  " Duplicates should be filtered out (option has P_NODUP)
+  let backupskip = &backupskip
+  set backupskip=
+  set backupskip+=/test/dir
+  set backupskip+=/other/dir
+  set backupskip+=/test/dir
+  call assert_equal('/test/dir,/other/dir', &backupskip)
+  let &backupskip = backupskip
 endfunc
 
 func Test_copy_winopt()
index 7432f70e0354d57f07bb52ddac01de67e24a0d51..5c41f4fbb027dabb0734ecc4aee95487f576b21c 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1519,
 /**/
     1518,
 /**/