Re: What's cooking in git.git (topics)
Junio C Hamano <gitster@pobox.com> writes:
Show 26 quoted lines
> I am personally very much in favor of removing "git clean", but
> having many people on the list saying loudly that it is a bad
> command is not good enough justification, as people who are
> content with the status quo tend to be silent.
>
> The steps I think is sensible to transition to that goal would
> be:
>
> - Change clean.requireForce to default to 'true' in the next
> (or one after) version of git, to make 'clean' even safer.
> See if anybody complains (I do not expect any).
>
> - Implement the same functionarity as a new option to "git rm",
> which is already in C.
>
> - Do "git clean" in C, but sharing the code with "git rm"
> implementation above.
>
> - Discuss deprecation and removal of redundant commands. Ship
> a version of git with deprecation and future removal notice.
> Outline how to achieve the same thing as the deprecated
> command used to do (or give convincing argument why what the
> deprecated command used to do was a bad thing and do not
> offer an alternative).
>
> - Wait for a while (6 months to 1 year) and then remove them.
And this is the first step.
---
Documentation/config.txt | 4 ++--
git-clean.sh | 6 +++++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index edf50cd..2144855 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -345,8 +345,8 @@ branch.<name>.mergeoptions::
supported.
clean.requireForce::
- A boolean to make git-clean do nothing unless given -f or -n. Defaults
- to false.
+ A boolean to make git-clean do nothing unless given -f
+ or -n. Defaults to true.
color.branch::
A boolean to enable/disable color in the output of
diff --git a/git-clean.sh b/git-clean.sh
index 4491738..f4965b8 100755
--- a/git-clean.sh
+++ b/git-clean.sh
@@ -20,12 +20,16 @@ require_work_tree
ignored=
ignoredonly=
cleandir=
-disabled="`git config --bool clean.requireForce`"
rmf="rm -f --"
rmrf="rm -rf --"
rm_refuse="echo Not removing"
echo1="echo"
+# requireForce used to default to false but now it defaults to true.
+# IOW, lack of explicit "clean.requireForce = false" is taken as
+# "clean.requireForce = true".
+disabled=$(git config --bool clean.requireForce || echo true)
+
while test $# != 0
do
case "$1" in