Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- builtin/clean.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/builtin/clean.c b/builtin/clean.c index 69c1cda..4cdabe0 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -46,7 +46,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix) struct strbuf buf = STRBUF_INIT; struct string_list exclude_list = STRING_LIST_INIT_NODUP; const char *qname; - char *seen = NULL; struct option options[] = { OPT__QUIET(&quiet, N_("do not print names of files removed")), OPT__DRY_RUN(&show_only, N_("dry run")), @@ -105,9 +104,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix) fill_directory(&dir, pathspec); - if (pathspec) - seen = xmalloc(argc > 0 ? argc : 1); - for (i = 0; i < dir.nr; i++) { struct dir_entry *ent = dir.entries[i]; int len, pos; @@ -141,11 +137,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix) if (lstat(ent->name, &st)) continue; - if (pathspec) { - memset(seen, 0, argc > 0 ? argc : 1); + if (pathspec) matches = match_pathspec(pathspec, ent->name, len, - 0, seen); - } + 0, NULL); if (S_ISDIR(st.st_mode)) { strbuf_addstr(&directory, ent->name); @@ -184,7 +178,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix) } } } - free(seen); strbuf_release(&directory); string_list_clear(&exclude_list, 0); -- 1.8.0.rc2.23.g1fb49df -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html