summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee78740)
raw | patch | inline | side by side (parent: ee78740)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 2 Nov 2007 00:32:04 +0000 (17:32 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 4 Nov 2007 09:54:41 +0000 (01:54 -0800) |
This makes the clean.requireForce configuration default to true.
Too many people are burned by typing "git clean" by mistake when
they meant to say "make clean".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Too many people are burned by typing "git clean" by mistake when
they meant to say "make clean".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt | patch | blob | history | |
git-clean.sh | patch | blob | history | |
t/t7201-co.sh | patch | blob | history | |
t/t7300-clean.sh | patch | blob | history |
index 7ee97df8a70cd6c6b127d7d32f5e325acc405c98..aeb7961adefeb098f4a468bb560dcc95be9abd0a 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
`.` (a period) for branch.<name>.remote.
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 44917381863e27de6bedc91fa742eb0f8211a492..f4965b8391436384bf795c1e39b7f9158e624e51 100755 (executable)
--- a/git-clean.sh
+++ b/git-clean.sh
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
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index ed2e9ee3c6fea4767f0aa288dca02825569abedf..55558aba8b862b93cb8ad97a681a4749bae3b3e1 100755 (executable)
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
test_expect_success "checkout -m with dirty tree" '
git checkout -f master &&
- git clean &&
+ git clean -f &&
fill 0 1 2 3 4 5 6 7 8 >one &&
git checkout -m side &&
test_expect_success "checkout -m with dirty tree, renamed" '
- git checkout -f master && git clean &&
+ git checkout -f master && git clean -f &&
fill 1 2 3 4 5 7 8 >one &&
if git checkout renamer
test_expect_success 'checkout -m with merge conflict' '
- git checkout -f master && git clean &&
+ git checkout -f master && git clean -f &&
fill 1 T 3 4 5 6 S 8 >one &&
if git checkout renamer
test_expect_success 'checkout to detach HEAD' '
- git checkout -f renamer && git clean &&
+ git checkout -f renamer && git clean -f &&
git checkout renamer^ &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
test_expect_success 'checkout to detach HEAD with branchname^' '
- git checkout -f master && git clean &&
+ git checkout -f master && git clean -f &&
git checkout renamer^ &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
test_expect_success 'checkout to detach HEAD with HEAD^0' '
- git checkout -f master && git clean &&
+ git checkout -f master && git clean -f &&
git checkout HEAD^0 &&
H=$(git rev-parse --verify HEAD) &&
M=$(git show-ref -s --verify refs/heads/master) &&
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index eb0847afe9825f4af46065c2ee38282c44789bfb..8697213e6b63fcaaaf2d91b7a3dc1b4e34f825ee 100755 (executable)
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
. ./test-lib.sh
+git config clean.requireForce no
+
test_expect_success 'setup' '
mkdir -p src &&
'
+test_expect_success 'clean.requireForce defaults to true' '
+
+ git config --unset clean.requireForce &&
+ ! git-clean
+
+'
+
test_expect_success 'clean.requireForce' '
git config clean.requireForce true &&