Re: [PATCH] clean: confirm before cleaning files and directories
From: Jiang Xin <hidden>
Date: 2016-06-15 22:57:01
2013/4/26 Matthieu Moy [off-list ref]
Jiang Xin [off-list ref] writes:quoted
* run `git clean` in interactive sessions, * not a dry run, * and not quiet.Err, does this mean I'll have: $ git clean fatal: clean.requireForce defaults to true and neither -n nor -f given; refusing to clean $ git clean --force
( you omit something, because nothing to clean won't trigger this confirm dialog)
Are you sure [y/n]? An optional confirmation dialog seems interesting, but activating it by default even with --force seems really weird.
I don't know how many programmers had been bitten by runing `git clean -fdx`,
but I bet there were some. I think safety should be put to the 1st place.
It is because "clean.requireForce" defaults to true, all people trend to run
'git clean' with the '--force/-f' option.
Maybe we can do like this:
1. Set the default value of 'clean.requireForce' to false.
2. Show a error message and do nothing, if there is not 'clean.requireForce'
setting, but the user called with a '--force' flag.
( like a transition for the change of push.default in git 2.0)
any opinions?
-- Matthieu Moy http://www-verimag.imag.fr/~moy/
-- 蒋鑫 北京群英汇信息技术有限公司 邮件: worldhello.net@gmail.com 网址: http://www.ossxp.com/ 博客: http://www.worldhello.net/ 微博: http://weibo.com/gotgit/ 电话: 18601196889