Skip to content

Commit 89c3850

Browse files
Michael J Grubergitster
authored andcommitted
git-clean: fix the description of the default behavior
Currently, when called without -n and -f, git clean issues fatal: clean.requireForce not set and -n or -f not given; refusing to clean which leaves the user wondering why force is required when requireForce is not set. Looking up in git-clean(1) does not help because its description is wrong. Change it so that git clean issues fatal: clean.requireForce defaults to true and -n or -f not given; refusing to clean in this situation (and "...set to true..." when it is set) which makes it clearer that an unset config means true here, and adjust the documentation. Signed-off-by: Michael J Gruber <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 76ea93c commit 89c3850

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Documentation/git-clean.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ OPTIONS
3333

3434
-f::
3535
--force::
36-
If the git configuration specifies clean.requireForce as true,
37-
'git clean' will refuse to run unless given -f or -n.
36+
If the git configuration variable clean.requireForce is not set
37+
to false, 'git clean' will refuse to run unless given -f or -n.
3838

3939
-n::
4040
--dry-run::

builtin-clean.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
6767
die("-x and -X cannot be used together");
6868

6969
if (!show_only && !force)
70-
die("clean.requireForce%s set and -n or -f not given; "
71-
"refusing to clean", config_set ? "" : " not");
70+
die("clean.requireForce %s to true and neither -n nor -f given; "
71+
"refusing to clean", config_set ? "set" : "defaults");
7272

7373
if (force > 1)
7474
rm_flags = 0;

0 commit comments

Comments
 (0)