git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiang Xin <worldhello.net@gmail.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Thomas Rast <trast@student.ethz.ch>
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH] clean: confirm before cleaning files and directories
Date: Fri, 26 Apr 2013 18:00:24 +0800	[thread overview]
Message-ID: <CANYiYbFTTGds3yU+-9BL=oTXFk5X4jR_MMR3cQVE4=qPgutWEg@mail.gmail.com> (raw)
In-Reply-To: <vpqwqrpfzez.fsf@grenoble-inp.fr>

2013/4/26 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
> Jiang Xin <worldhello.net@gmail.com> 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.default in git 2.0)
>
> Perhaps introducing a new value for 'clean.requireForce':
>
> $ git config --global clean.requireForce ask
> $ git clean
> .will remove ...
> are you sure [y/N]?
>
> The error message when clean.requireForce is unset and --force is not
> given could point the user to clean.requireForce=ask.

Add new value for clean.requireForce would break old git clent.

   $ git clean
   fatal: bad config value for 'clean.requireforce' in .git/config

>
> Then, maybe, later, this could become the default. But I tend to like
> the non-interactive nature of most Git commands, so I'm a bit reluctant
> here. My way of doing the confirmation dialog is
>
> $ git clean -n
> would remove ...
> $ git clean -f
>

I try to put all cases in one table, but still looks weird.

    | clean.requireForce  |     git clean     | git clean --force |
    +---------------------+-------------------|-------------------|
    | TRUE                | error             | delete...         |
    +---------------------+-------------------|-------------------|
    | FALSE               | delete...         | delete...         |
    +---------------------+-------------------|-------------------|
    | unset               | confirm           | warn + confirm    |
    +---------------------+-------------------|-------------------|

Does anyone really set and use "clean.requireForce" setting?
And if there is a confirm dialog, do we need 'clean.requireForce' any more?
Or we can add a `--no-ask` option, in order to override the confirm dialog.


> --
> 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

  reply	other threads:[~2013-04-26 10:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26  8:07 [PATCH] clean: confirm before cleaning files and directories Jiang Xin
2013-04-26  8:21 ` Matthieu Moy
2013-04-26  8:41   ` Jiang Xin
2013-04-26  8:51     ` Matthieu Moy
2013-04-26 10:00       ` Jiang Xin [this message]
2013-04-26  8:53     ` Thomas Rast
2013-04-26 16:10     ` Junio C Hamano
2013-04-26 16:19       ` Matthieu Moy
2013-04-26 17:07         ` Junio C Hamano
2013-04-26 19:06           ` Junio C Hamano
2013-04-27  2:09             ` Jiang Xin
2013-04-27 16:13             ` [PATCH v2] Add support for -i/--interactive to git-clean Jiang Xin
2013-04-27 21:41               ` Matthieu Moy
2013-04-27 23:11                 ` Junio C Hamano
2013-04-28  2:03               ` Eric Sunshine
2013-04-29  8:03               ` Matthieu Moy
2013-04-29 14:30                 ` [PATCH] clean: Introduce -z for machine readable output Michael J Gruber
2013-04-29 14:45                   ` Matthieu Moy
2013-04-29 16:15                 ` [PATCH v2] Add support for -i/--interactive to git-clean Jiang Xin
2013-04-30 19:25                   ` [PATCH v3] " Jiang Xin
2013-05-01 15:12                     ` Matthieu Moy
2013-05-02 13:15                       ` [PATCH v4 1/3] " Jiang Xin
2013-05-02 13:15                       ` [PATCH v4 2/3] Show items of interactive git-clean in columns Jiang Xin
2013-05-02 15:03                         ` Matthieu Moy
2013-05-03  1:26                           ` Jiang Xin
2013-05-03 12:54                             ` Matthieu Moy
2013-05-02 13:15                       ` [PATCH v4 3/3] Add colors to interactive git-clean Jiang Xin
2013-05-02 15:07                         ` Matthieu Moy
2013-05-03  2:53                           ` Jiang Xin
2013-05-02 13:43                       ` [PATCH v3] Add support for -i/--interactive to git-clean Jiang Xin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANYiYbFTTGds3yU+-9BL=oTXFk5X4jR_MMR3cQVE4=qPgutWEg@mail.gmail.com' \
    --to=worldhello.net@gmail.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).