From 9e385404b3443f201f1092ba76bcdafd1f303976 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 28 Feb 2016 12:59:13 +0100 Subject: vim-patch:7.4.1116 Problem: delete(x, 'rf') does not delete files starting with a dot. Solution: Also delete files starting with a dot. https://github.com/vim/vim/commit/b0967d587fc420fa02832533d4915c85d1a78c17 --- src/nvim/path.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/nvim/path.c') diff --git a/src/nvim/path.c b/src/nvim/path.c index aaf54bc5b4..8ba3fe3358 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -604,8 +604,8 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, starstar = true; // convert the file pattern to a regexp pattern - int starts_with_dot = (*s == '.'); - char_u *pat = file_pat_to_reg_pat(s, e, NULL, false); + int starts_with_dot = *s == '.' || (flags & EW_DODOT); + char_u *pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { xfree(buf); return 0; @@ -649,7 +649,9 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, char_u *name; scandir_next_with_dots(NULL /* initialize */); while((name = (char_u *) scandir_next_with_dots(&dir)) && name != NULL) { - if ((name[0] != '.' || starts_with_dot) + if ((name[0] != '.' || (starts_with_dot + && name[1] != NUL + && (name[1] != '.' || name[2] != NUL))) && ((regmatch.regprog != NULL && vim_regexec(®match, name, 0)) || ((flags & EW_NOTWILD) && fnamencmp(path + (s - buf), name, e - s) == 0))) { -- cgit From a252fca38e0e5bf8501b72c2a9cfd2acf1cf9fff Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 28 Feb 2016 13:12:12 +0100 Subject: Fix linter errors. --- src/nvim/path.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/path.c') diff --git a/src/nvim/path.c b/src/nvim/path.c index 8ba3fe3358..4b15afbfc1 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -605,7 +605,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, // convert the file pattern to a regexp pattern int starts_with_dot = *s == '.' || (flags & EW_DODOT); - char_u *pat = file_pat_to_reg_pat(s, e, NULL, FALSE); + char_u *pat = file_pat_to_reg_pat(s, e, NULL, false); if (pat == NULL) { xfree(buf); return 0; @@ -647,8 +647,8 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, if (os_file_is_readable(dirpath) && os_scandir(&dir, dirpath)) { // Find all matching entries. char_u *name; - scandir_next_with_dots(NULL /* initialize */); - while((name = (char_u *) scandir_next_with_dots(&dir)) && name != NULL) { + scandir_next_with_dots(NULL); // initialize + while ((name = (char_u *) scandir_next_with_dots(&dir)) && name != NULL) { if ((name[0] != '.' || (starts_with_dot && name[1] != NUL && (name[1] != '.' || name[2] != NUL))) -- cgit From 29b737e92b5865918ca1e8c5a30e6c6f3a351915 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 28 Feb 2016 13:21:01 +0100 Subject: vim-patch:7.4.1117 Problem: No longer get "." and ".." in directory list. Solution: Do not skip "." and ".." unless EW_DODOT is set. https://github.com/vim/vim/commit/d82103ed8534a1207742e9666ac7ef1e47dda12d --- src/nvim/path.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/nvim/path.c') diff --git a/src/nvim/path.c b/src/nvim/path.c index 4b15afbfc1..a6e8aa6236 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -604,7 +604,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, starstar = true; // convert the file pattern to a regexp pattern - int starts_with_dot = *s == '.' || (flags & EW_DODOT); + int starts_with_dot = *s == '.'; char_u *pat = file_pat_to_reg_pat(s, e, NULL, false); if (pat == NULL) { xfree(buf); @@ -649,9 +649,10 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, char_u *name; scandir_next_with_dots(NULL); // initialize while ((name = (char_u *) scandir_next_with_dots(&dir)) && name != NULL) { - if ((name[0] != '.' || (starts_with_dot - && name[1] != NUL - && (name[1] != '.' || name[2] != NUL))) + if ((name[0] != '.' + || starts_with_dot + || ((flags & EW_DODOT) + && name[1] != NUL && (name[1] != '.' || name[2] != NUL))) && ((regmatch.regprog != NULL && vim_regexec(®match, name, 0)) || ((flags & EW_NOTWILD) && fnamencmp(path + (s - buf), name, e - s) == 0))) { -- cgit From 425fcdb5b4bc6dec05dafe2e2675c8a7cfe37187 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sun, 28 Feb 2016 13:26:10 +0100 Subject: vim-patch:7.4.1120 Problem: delete(x, 'rf') fails if a directory is empty. (Lcd) Solution: Ignore not finding matches in an empty directory. https://github.com/vim/vim/commit/336bd622c31e1805495c034e1a8cfadcc0bbabc7 --- src/nvim/path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/path.c') diff --git a/src/nvim/path.c b/src/nvim/path.c index a6e8aa6236..d3df9bc059 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1223,7 +1223,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, recursive = false; - return (ga.ga_data != NULL) ? OK : FAIL; + return ((flags & EW_EMPTYOK) || ga.ga_data != NULL) ? OK : FAIL; } -- cgit