All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Thomas Rast <trast@inf.ethz.ch>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH v3] Add support for -i/--interactive to git-clean
Date: Wed, 01 May 2013 17:12:04 +0200	[thread overview]
Message-ID: <vpq38u6n397.fsf@grenoble-inp.fr> (raw)
In-Reply-To: <3ecc9ca1b1363b5bd27ae53cbf5899ce6d44cd48.1367349734.git.worldhello.net@gmail.com> (Jiang Xin's message of "Wed, 1 May 2013 03:25:11 +0800")

Jiang Xin <worldhello.net@gmail.com> writes:

> Show what would be done and the user must confirm before actually
> cleaning. In the confirmation dialog, the user has three choices:
>
>  * Yes: Start to do cleaning.
>  * No:  Nothing will be deleted.
>  * Edit (default): Enter edit mode.

I like this much more than the previous one. I played with it a bit, and
found it much more pleasant than "rm -i": by default, only one querry,
but still an option to select which files to clean.

I'm wondering whether "Enter" in the edit mode should return to the
yes/no/Edit querry instead of applying the clean. It would make it clear
for the user that it's still possible to cancel completely (the
Control-C hint is not visible in the UI otherwise).

> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>

Please, no. I already mentionned it in my previous patch, but I did not
review the patch. See SubmittingPatches:

  3. "Reviewed-by:", unlike the other tags, can only be offered by the
     reviewer and means that she is completely satisfied that the patch
     is ready for application.  It is usually offered only after a
     detailed review.

Commenting != reviewing.

> +		/* dels list may become empty when we run string_list_remove_empty_items later */
> +		if (!dels->nr)
> +			break;

This happens when the user removed everything from the list in the edit
mode. This could print something before breaking (and then exiting
silently). Maybe "No more files to clean, exiting." or so.

> +			printf(_("Remove (yes/no/Edit) ? "));
> +			strbuf_getline(&confirm, stdin, '\n');
> +			strbuf_trim(&confirm);
> +			if (confirm.len) {
> +				if (!strncasecmp(confirm.buf, "yes", confirm.len)) {
> +					break;
> +				} else if (!strncasecmp(confirm.buf, "no", confirm.len)) {
> +					string_list_clear(dels, 0);
> +					break;
> +				}
> +			}
> +			edit_mode = 1;

It's weird that anything but "yes" and "no" enter the edit mode without
complaining. It's safe, but surprising. If I type "foo", I'd rather get
an error and be asked again.

> +		if (!matches) {
> +			strbuf_addf(&message, _("WARNING: Cannot find items prefixed by: %s"), confirm.buf);

"prefixed" seems a remainder of the previous version of the patch. You
probably mean "matched by: %s".

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2013-05-01 15:14 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
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 [this message]
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=vpq38u6n397.fsf@grenoble-inp.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.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.