Skip to content

Commit

Permalink
Merge branch 'dt/clean-pathspec-filter-then-lstat' into maint
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Jun 16, 2015
2 parents b76b4cd + 838d6a9 commit 6b2c0ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin/clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6b2c0ea

Please sign in to comment.