Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Jiang Xin
2013/4/27 Junio C Hamano : > Junio C Hamano writes: > >> Matthieu Moy writes: >> >>> The nice thing with the confirmation dialog is that it shows the list >>> before asking (and unlike 'rm -i', it asks only once). >> >> I wouldn't object to having "clean -i", which automatically defeats >> the re

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Junio C Hamano
Junio C Hamano writes: > Matthieu Moy writes: > >> The nice thing with the confirmation dialog is that it shows the list >> before asking (and unlike 'rm -i', it asks only once). > > I wouldn't object to having "clean -i", which automatically defeats > the requireforce option. > > As to a huge s

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Junio C Hamano
Matthieu Moy writes: > The nice thing with the confirmation dialog is that it shows the list > before asking (and unlike 'rm -i', it asks only once). I wouldn't object to having "clean -i", which automatically defeats the requireforce option. As to a huge single list you have to approve or reje

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Matthieu Moy
Junio C Hamano writes: > "git clean" without -n/f errors out, hinting the availablilty of -n > while mentioning -f; that is the safety, isn't it? Once the user > decides to give -f, the user _wants_ to remove cruft, and it is a > hinderance to require any further confirmation. This is only half

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Junio C Hamano
Jiang Xin writes: > 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. "git clean" without -n/f errors out, hinting the availablilty of -n while mentioning -f; that is the safety, isn't it? On

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Jiang Xin
2013/4/26 Matthieu Moy : > Jiang Xin writes: > >> 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 t

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Thomas Rast
Jiang Xin writes: > 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.

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Matthieu Moy
Jiang Xin writes: > 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.d

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Jiang Xin
2013/4/26 Matthieu Moy > > Jiang Xin writes: > > > * 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 clea

Re: [PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Matthieu Moy
Jiang Xin writes: > * 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 Are you sure [y/n]? An optional conf

[PATCH] clean: confirm before cleaning files and directories

2013-04-26 Thread Jiang Xin
When running `git clean`, it will be convenient and safe to show a confirm dialog and only delete files and directories when confirmed. The confirm dialog will popup when: * run `git clean` in interactive sessions, * not a dry run, * and not quiet. There may be existing scripts that call `git