summaryrefslogtreecommitdiff
path: root/builtin/clean.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-05-20 08:54:58 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-05-20 08:54:59 +0900
commit33be431c0c7284c1adf0fe49f7838dbc8aee6ea9 (patch)
treece7b37182ebe1c89b0d9d4f5ced18e514e60c09d /builtin/clean.c
parentMerge branch 'ab/perl-makefile-cleanup' (diff)
parentdir: introduce readdir_skip_dot_and_dotdot() helper (diff)
downloadtgif-33be431c0c7284c1adf0fe49f7838dbc8aee6ea9.tar.xz
Merge branch 'en/dir-traversal'
"git clean" and "git ls-files -i" had confusion around working on or showing ignored paths inside an ignored directory, which has been corrected. * en/dir-traversal: dir: introduce readdir_skip_dot_and_dotdot() helper dir: update stale description of treat_directory() dir: traverse into untracked directories if they may have ignored subfiles dir: avoid unnecessary traversal into ignored directory t3001, t7300: add testcase showcasing missed directory traversal t7300: add testcase showing unnecessary traversal into ignored directory ls-files: error out on -i unless -o or -c are specified dir: report number of visited directories and paths with trace2 dir: convert trace calls to trace2 equivalents
Diffstat (limited to 'builtin/clean.c')
-rw-r--r--builtin/clean.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/clean.c b/builtin/clean.c
index f6d7e8119c..4944cf440b 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -189,10 +189,8 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag,
strbuf_complete(path, '/');
len = path->len;
- while ((e = readdir(dir)) != NULL) {
+ while ((e = readdir_skip_dot_and_dotdot(dir)) != NULL) {
struct stat st;
- if (is_dot_or_dotdot(e->d_name))
- continue;
strbuf_setlen(path, len);
strbuf_addstr(path, e->d_name);