]> granicus.if.org Git - vim/commitdiff
patch 7.4.1116 v7.4.1116
authorBram Moolenaar <Bram@vim.org>
Sun, 17 Jan 2016 15:49:43 +0000 (16:49 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 17 Jan 2016 15:49:43 +0000 (16:49 +0100)
Problem:    delete(x, 'rf') does not delete files starting with a dot.
Solution:   Also delete files starting with a dot.

src/fileio.c
src/misc1.c
src/version.c
src/vim.h

index f809eb5bc36dbad5ecbfaaf07f877d0c9f6eb619..fdaad20bbc0702431187c6ed9ac795e30deea7cb 100644 (file)
@@ -7313,7 +7313,7 @@ delete_recursive(char_u *name)
        if (exp == NULL)
            return -1;
        if (gen_expand_wildcards(1, &exp, &file_count, &files,
-                                             EW_DIR|EW_FILE|EW_SILENT) == OK)
+                        EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT) == OK)
        {
            for (i = 0; i < file_count; ++i)
                if (delete_recursive(files[i]) != 0)
index 4f36fd80d1c18143b7c2a5f17791aa58ab19b2bd..66569d4a0940013bb2f5c526547b857206e19c7e 100644 (file)
@@ -10013,7 +10013,7 @@ dos_expandpath(
        if (p[0] == '*' && p[1] == '*')
            starstar = TRUE;
 
-    starts_with_dot = (*s == '.');
+    starts_with_dot = *s == '.' || (flags & EW_DODOT);
     pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
     if (pat == NULL)
     {
@@ -10096,7 +10096,8 @@ dos_expandpath(
 #endif
        /* Ignore entries starting with a dot, unless when asked for.  Accept
         * all entries found with "matchname". */
-       if ((p[0] != '.' || starts_with_dot)
+       if ((p[0] != '.' || (starts_with_dot
+                       && p[1] != NUL && (p[1] != '.' || p[2] != NUL)))
                && (matchname == NULL
                  || (regmatch.regprog != NULL
                                     && vim_regexec(&regmatch, p, (colnr_T)0))
@@ -10325,7 +10326,7 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
            starstar = TRUE;
 
     /* convert the file pattern to a regexp pattern */
-    starts_with_dot = (*s == '.');
+    starts_with_dot = *s == '.' || (flags & EW_DODOT);
     pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
     if (pat == NULL)
     {
@@ -10374,7 +10375,9 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
            dp = readdir(dirp);
            if (dp == NULL)
                break;
-           if ((dp->d_name[0] != '.' || starts_with_dot)
+           if ((dp->d_name[0] != '.' || (starts_with_dot
+                       && dp->d_name[1] != NUL
+                       && (dp->d_name[1] != '.' || dp->d_name[2] != NUL)))
                 && ((regmatch.regprog != NULL && vim_regexec(&regmatch,
                                             (char_u *)dp->d_name, (colnr_T)0))
                   || ((flags & EW_NOTWILD)
index 4e23c616142964f4e2187cea9480308bfa3af9f1..50a682719400ca299844237d0a78630038429164 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1116,
 /**/
     1115,
 /**/
index a8a6eadfef5c6124319b5ae6d4be938148958bb0..a39c6fda5e7f3d73587a6aef38dac46def0a1c58 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -835,6 +835,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
 #define EW_ALLLINKS    0x1000  /* also links not pointing to existing file */
 #define EW_SHELLCMD    0x2000  /* called from expand_shellcmd(), don't check
                                 * if executable is in $PATH */
+#define EW_DODOT       0x4000  /* also files starting with a dot */
 
 /* Flags for find_file_*() functions. */
 #define FINDFILE_FILE  0       /* only files */