diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-06-16 14:33:46 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-16 14:33:46 -0700 |
commit | 6b2c0ead061b1bb9ce8e4b539da495ea0ef057b5 (patch) | |
tree | 9678b679f36a40abfb331c9c7a07ffc0b24e4261 | |
parent | Merge branch 'jk/http-backend-deadlock' into maint (diff) | |
parent | clean: only lstat files in pathspec (diff) | |
download | tgif-6b2c0ead061b1bb9ce8e4b539da495ea0ef057b5.tar.xz |
Merge branch 'dt/clean-pathspec-filter-then-lstat' into maint
"git clean pathspec..." tried to lstat(2) and complain even for
paths outside the given pathspec.
* dt/clean-pathspec-filter-then-lstat:
clean: only lstat files in pathspec
-rw-r--r-- | builtin/clean.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/clean.c b/builtin/clean.c index 98c103fa8b..ada0196c9e 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -941,15 +941,15 @@ int cmd_clean(int argc, const char **argv, const char *prefix) if (!cache_name_is_other(ent->name, ent->len)) continue; - if (lstat(ent->name, &st)) - die_errno("Cannot lstat '%s'", ent->name); - if (pathspec.nr) matches = dir_path_match(ent, &pathspec, 0, NULL); if (pathspec.nr && !matches) continue; + if (lstat(ent->name, &st)) + die_errno("Cannot lstat '%s'", ent->name); + if (S_ISDIR(st.st_mode) && !remove_directories && matches != MATCHED_EXACTLY) continue; |