From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Thomas Rast <trast@inf.ethz.ch>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH v2] Add support for -i/--interactive to git-clean
Date: Mon, 29 Apr 2013 10:03:41 +0200 [thread overview]
Message-ID: <vpqwqrl931e.fsf@grenoble-inp.fr> (raw)
In-Reply-To: <2a68239bfd3e6b9ea1842dd8e468ee3d3217af5b.1367079089.git.worldhello.net@gmail.com> (Jiang Xin's message of "Sun, 28 Apr 2013 00:13:26 +0800")
Jiang Xin <worldhello.net@gmail.com> writes:
> Show what would be done and a confirmation dialog before actually
> cleaning. In the confirmation dialog, the user can input a space
> separated prefix list, and each clean candidate that matches with
> one of prefix, will be excluded from cleaning.
That seems a really weird interface. In particular, that means people
typing "no" or "n" mechanically will have everything not starting with
"n" or "no" deleted. We've learnt from the "git send-email" interface
that people (including me ;-) ) do type "yes" mechanically to some
questions.
You may argue that users are not stupid and know what they do, but the
point of this -i is to protect users against their fingers (typing -f
without thinking) for a potentially very destructive command ...
My feeling is that you're doing a bad compromise between a confirmation
dialog (y/n) and a really interactive command (like "git add -i") with a
rich interface.
> @@ -34,7 +34,17 @@ OPTIONS
> -f::
> --force::
> If the Git configuration variable clean.requireForce is not set
> - to false, 'git clean' will refuse to run unless given -f or -n.
> + to false, 'git clean' will refuse to run unless given -f, -n or
> + -i.
> +
> +-i::
> +--interactive::
> + Show what would be done and a confirmation dialog before actually
> + cleaning. In the confirmation dialog, the user can input a space
> + separated prefix list, and each clean candidate that matches with
> + one of prefix, will be excluded from cleaning. When the user feels
> + it's OK, press ENTER to start cleaning. If the user wants to cancel
> + the whole cleaning, simply input ctrl-c in the confirmation dialog.
Broken indentation. It seems you've set your tab-width to 2, in which
case you can't see it, but you've indented with 2 spaces where the rest
of the file is indented with tabs.
> if (S_ISDIR(st.st_mode)) {
> - strbuf_addstr(&directory, ent->name);
> if (remove_directories || (matches == MATCHED_EXACTLY)) {
> - if (remove_dirs(&directory, prefix, rm_flags, dry_run, quiet, &gone))
> - errors++;
> - if (gone && !quiet) {
> - qname = quote_path_relative(directory.buf, directory.len, &buf, prefix);
> - printf(dry_run ? _(msg_would_remove) : _(msg_remove), qname);
> - }
> + string_list_append(&dels, ent->name);
The patch would be much easier to read if split into a first refactoring
patch that would introduce this "dels" list, and a second patch that
would introduce -i. Reading this, I wondered why the code was removed,
while it was actually just moved.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2013-04-29 8:03 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
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 [this message]
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=vpqwqrl931e.fsf@grenoble-inp.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@inf.ethz.ch \
--cc=worldhello.net@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.