diff options
Diffstat (limited to 'third_party/git/builtin/clean.c')
-rw-r--r-- | third_party/git/builtin/clean.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/third_party/git/builtin/clean.c b/third_party/git/builtin/clean.c index 5abf087e7c49..d5579da716e0 100644 --- a/third_party/git/builtin/clean.c +++ b/third_party/git/builtin/clean.c @@ -158,8 +158,7 @@ static int remove_dirs(struct strbuf *path, const char *prefix, int force_flag, *dir_gone = 1; - if ((force_flag & REMOVE_DIR_KEEP_NESTED_GIT) && - is_nonbare_repository_dir(path)) { + if ((force_flag & REMOVE_DIR_KEEP_NESTED_GIT) && is_nonbare_repository_dir(path)) { if (!quiet) { quote_path_relative(path->buf, prefix, "ed); printf(dry_run ? _(msg_would_skip_git_dir) : _(msg_skip_git_dir), @@ -649,7 +648,7 @@ static int filter_by_patterns_cmd(void) struct strbuf confirm = STRBUF_INIT; struct strbuf **ignore_list; struct string_list_item *item; - struct pattern_list *pl; + struct exclude_list *el; int changed = -1, i; for (;;) { @@ -672,7 +671,7 @@ static int filter_by_patterns_cmd(void) break; memset(&dir, 0, sizeof(dir)); - pl = add_pattern_list(&dir, EXC_CMDL, "manual exclude"); + el = add_exclude_list(&dir, EXC_CMDL, "manual exclude"); ignore_list = strbuf_split_max(&confirm, ' ', 0); for (i = 0; ignore_list[i]; i++) { @@ -680,7 +679,7 @@ static int filter_by_patterns_cmd(void) if (!ignore_list[i]->len) continue; - add_pattern(ignore_list[i]->buf, "", 0, pl, -(i+1)); + add_exclude(ignore_list[i]->buf, "", 0, el, -(i+1)); } changed = 0; @@ -902,7 +901,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix) struct pathspec pathspec; struct strbuf buf = STRBUF_INIT; struct string_list exclude_list = STRING_LIST_INIT_NODUP; - struct pattern_list *pl; + struct exclude_list *el; struct string_list_item *item; const char *qname; struct option options[] = { @@ -947,19 +946,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix) if (force > 1) rm_flags = 0; - else - dir.flags |= DIR_SKIP_NESTED_GIT; dir.flags |= DIR_SHOW_OTHER_DIRECTORIES; - if (argc) { - /* - * Remaining args implies pathspecs specified, and we should - * recurse within those. - */ - remove_directories = 1; - } - if (remove_directories) dir.flags |= DIR_SHOW_IGNORED_TOO | DIR_KEEP_UNTRACKED_CONTENTS; @@ -969,9 +958,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix) if (!ignored) setup_standard_excludes(&dir); - pl = add_pattern_list(&dir, EXC_CMDL, "--exclude option"); + el = add_exclude_list(&dir, EXC_CMDL, "--exclude option"); for (i = 0; i < exclude_list.nr; i++) - add_pattern(exclude_list.items[i].string, "", 0, pl, -(i+1)); + add_exclude(exclude_list.items[i].string, "", 0, el, -(i+1)); parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_CWD, @@ -1018,7 +1007,6 @@ int cmd_clean(int argc, const char **argv, const char *prefix) for_each_string_list_item(item, &del_list) { struct stat st; - strbuf_reset(&abs_path); if (prefix) strbuf_addstr(&abs_path, prefix); @@ -1052,6 +1040,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix) printf(dry_run ? _(msg_would_remove) : _(msg_remove), qname); } } + strbuf_reset(&abs_path); } strbuf_release(&abs_path); |