Skip to content

Commit 1617adc

Browse files
sbohrergitster
authored andcommitted
Teach git clean to use setup_standard_excludes()
Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 625db1b commit 1617adc

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

builtin-clean.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static int git_clean_config(const char *var, const char *value)
2222
{
2323
if (!strcmp(var, "clean.requireforce"))
2424
force = !git_config_bool(var, value);
25-
return 0;
25+
return git_default_config(var, value);
2626
}
2727

2828
int cmd_clean(int argc, const char **argv, const char *prefix)
@@ -55,10 +55,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
5555
argc = parse_options(argc, argv, options, builtin_clean_usage, 0);
5656

5757
memset(&dir, 0, sizeof(dir));
58-
if (ignored_only) {
59-
dir.show_ignored =1;
60-
dir.exclude_per_dir = ".gitignore";
61-
}
58+
if (ignored_only)
59+
dir.show_ignored = 1;
6260

6361
if (ignored && ignored_only)
6462
die("-x and -X cannot be used together");
@@ -69,13 +67,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
6967

7068
dir.show_other_directories = 1;
7169

72-
if (!ignored) {
73-
dir.exclude_per_dir = ".gitignore";
74-
if (!access(git_path("info/exclude"), F_OK)) {
75-
char *exclude_path = git_path("info/exclude");
76-
add_excludes_from_file(&dir, exclude_path);
77-
}
78-
}
70+
if (!ignored)
71+
setup_standard_excludes(&dir);
7972

8073
pathspec = get_pathspec(prefix, argv);
8174
read_cache();

0 commit comments

Comments
 (0)