# [PATCH] git-clean: fix the description of the default behavior

4 messages from 2010-02-04 to 2010-02-05. Participants: Michael J Gruber, Junio C Hamano, Jay Soffian.
Thread: https://gitlist.dev/t/22520

## Michael J Gruber, 2010-02-04 16:01

Subject: [PATCH] git-clean: fix the description of the default behavior
Message-ID: <dafb1423c81bc2207d06cf2a97205bcbd9a4968e.1265299086.git.git@drmicha.warpmail.net>
URL: https://gitlist.dev/e/dafb1423c81bc2207d06cf2a97205bcbd9a4968e.1265299086.git.git%40drmicha.warpmail.net

```
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 <git@drmicha.warpmail.net>
---
I'd actually suggest changing "and -n or -f not given" to "and neither -n nor -f given"
in addition to the above, but the above is a real fix, whereas the latter is a style
issue, and we're close to release.

In fact, having a variable where unset means true is rather unfortunate,
but I don't expect that to be changing.

 Documentation/git-clean.txt |    4 ++--
 builtin-clean.c             |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 335c885..a81cb6c 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -33,8 +33,8 @@ OPTIONS
 
 -f::
 --force::
-	If the git configuration specifies clean.requireForce as true,
-	'git clean' will refuse to run unless given -f or -n.
+	If the git configuration variable clean.requireForce is not set
+	to false, 'git clean' will refuse to run unless given -f or -n.
 
 -n::
 --dry-run::
diff --git a/builtin-clean.c b/builtin-clean.c
index 3a70fa8..6ad5892 100644
--- a/builtin-clean.c
+++ b/builtin-clean.c
@@ -67,8 +67,8 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 		die("-x and -X cannot be used together");
 
 	if (!show_only && !force)
-		die("clean.requireForce%s set and -n or -f not given; "
-		    "refusing to clean", config_set ? "" : " not");
+		die("clean.requireForce %s to true and -n or -f not given; "
+		    "refusing to clean", config_set ? "set" : "defaults");
 
 	if (force > 1)
 		rm_flags = 0;
-- 
1.7.0.rc1.199.g9253ab

```

## Junio C Hamano, 2010-02-04 17:15

Subject: Re: [PATCH] git-clean: fix the description of the default behavior
Message-ID: <7veil0gbw8.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7veil0gbw8.fsf%40alter.siamese.dyndns.org
In-Reply-To: <dafb1423c81bc2207d06cf2a97205bcbd9a4968e.1265299086.git.git@drmicha.warpmail.net>

```
looks sane; thanks.

```

## Jay Soffian, 2010-02-04 21:16

Subject: Re: [PATCH] git-clean: fix the description of the default behavior
Message-ID: <76718491002041316x31f02e0bq5c47a2a96aadb6f4@mail.gmail.com>
URL: https://gitlist.dev/e/76718491002041316x31f02e0bq5c47a2a96aadb6f4%40mail.gmail.com
In-Reply-To: <dafb1423c81bc2207d06cf2a97205bcbd9a4968e.1265299086.git.git@drmicha.warpmail.net>

```
On Thu, Feb 4, 2010 at 11:01 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> fatal: clean.requireForce defaults to true and -n or -f not given; refusing to clean

Bike shed:

fatal: clean.requireForce defaults to true and neither -n nor -f
given; refusing to clean

j.

```

## Michael J Gruber, 2010-02-05 09:06

Subject: Re: [PATCH] git-clean: fix the description of the default behavior
Message-ID: <4B6BDF8F.1080902@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4B6BDF8F.1080902%40drmicha.warpmail.net
In-Reply-To: <76718491002041316x31f02e0bq5c47a2a96aadb6f4@mail.gmail.com>

```
Jay Soffian venit, vidit, dixit 04.02.2010 22:16:
> On Thu, Feb 4, 2010 at 11:01 AM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> fatal: clean.requireForce defaults to true and -n or -f not given; refusing to clean
> 
> Bike shed:
> 
> fatal: clean.requireForce defaults to true and neither -n nor -f
> given; refusing to clean
> 
> j.

Assuming you're not git-am, you do read between "---" and diff, don't
you? ;)

Michael

```
