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
This commit is contained in:
@ -941,15 +941,15 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
|
|||||||
if (!cache_name_is_other(ent->name, ent->len))
|
if (!cache_name_is_other(ent->name, ent->len))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (lstat(ent->name, &st))
|
|
||||||
die_errno("Cannot lstat '%s'", ent->name);
|
|
||||||
|
|
||||||
if (pathspec.nr)
|
if (pathspec.nr)
|
||||||
matches = dir_path_match(ent, &pathspec, 0, NULL);
|
matches = dir_path_match(ent, &pathspec, 0, NULL);
|
||||||
|
|
||||||
if (pathspec.nr && !matches)
|
if (pathspec.nr && !matches)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (lstat(ent->name, &st))
|
||||||
|
die_errno("Cannot lstat '%s'", ent->name);
|
||||||
|
|
||||||
if (S_ISDIR(st.st_mode) && !remove_directories &&
|
if (S_ISDIR(st.st_mode) && !remove_directories &&
|
||||||
matches != MATCHED_EXACTLY)
|
matches != MATCHED_EXACTLY)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user