public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sergey Organov <sorganov@gmail•com>
To: Junio C Hamano <gitster@pobox•com>
Cc: Elijah Newren <newren@gmail•com>,  git@vger•kernel.org
Subject: Re: what should "git clean -n -f [-d] [-x] <pattern>" do?
Date: Sat, 27 Jan 2024 16:25:29 +0300	[thread overview]
Message-ID: <87il3enc1i.fsf@osv.gnss.ru> (raw)
In-Reply-To: <xmqqzfwrjdul.fsf@gitster.g> (Junio C. Hamano's message of "Sat, 27 Jan 2024 02:00:02 -0800")

Junio C Hamano <gitster@pobox•com> writes:

> Sergey Organov <sorganov@gmail•com> writes:
>
>> I'm still arguing in favor of fixing "-n", and I believe a fix is needed
>> independently from decision about "-f -f".
>
> Even though I do not personally like it, I do not think "which
> between do-it (f) and do-not-do-it (n) do you want to use?" is
> broken.

Well, you are right, but "-n" is not documented as "do-not-do-it" in the
sense you use it here. 

> It sometimes irritates me to find "git clean" (without "-f"
> or "-n", and with clean.requireForce not disabled) complain, and I
> personally think "git clean" when clean.requireForce is in effect
> and no "-n" or "-f" were given should pretend as if "-n" were given.
> I wish if it were "without -n or -f, we pretend as if -n were given,
> possibly with a warning that says 'you need -f if you actually want
> to carry out these operations'".

Yep, then we'd not need "-n" that much, only if to cancel explicit "-f"
(provided "-f -f" feature is removed.)

>
> But that is a separate usability issue.

Yep, and that'd be very different design. 

>
> What I find broken is that giving one 'f' and one 'n' in different
> order, i.e. "-f -n" and "-n -f", does not do what I expect.  If you
> are choosing between do-it (f) and do-not-do-it (n), you ought to be
> able to rely on the usual last-one-wins rule.  That I find broken.

I fail to see where this expectation comes from, provided "-n" is not
documented as anything opposed to "-f":

       -n, --dry-run
           Don’t actually remove anything, just show what would be done.

This is typical convenient description of "dry run", and current "-n"
implementation is rather close to the description, that I'd still
rewrite to emphasize the primary goal of the --dry-run:

       -n, --dry-run
           Show what would be done, and don’t actually remove anything.

With these descriptions, the last thing that I'd expect is "-n -f"
removing my files.

Overall, as I see it, we have buggy implementation of suitably
documented "--dry-run" option, and the best course is to fix the
bug, with no semantic changes to the option itself.

Thanks,
-- Sergey Organov

  reply	other threads:[~2024-01-27 13:25 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 20:20 what should "git clean -n -f [-d] [-x] <pattern>" do? Junio C Hamano
2024-01-09 22:04 ` Sergey Organov
2024-01-19  2:07 ` Elijah Newren
2024-01-23 15:10   ` Sergey Organov
2024-01-23 18:34     ` Junio C Hamano
2024-01-24  8:23       ` Sergey Organov
2024-01-24 17:21         ` Junio C Hamano
2024-01-25 17:11           ` Sergey Organov
2024-01-25 17:46             ` Junio C Hamano
2024-01-25 20:27               ` Sergey Organov
2024-01-25 20:31                 ` Sergey Organov
2024-01-26  7:44                   ` Junio C Hamano
2024-01-26 12:09                     ` Sergey Organov
2024-01-27 10:00                       ` Junio C Hamano
2024-01-27 13:25                         ` Sergey Organov [this message]
2024-01-29 19:40                           ` Kristoffer Haugsbakk
2024-01-31 13:04                           ` Sergey Organov
2024-01-29  9:35                         ` Sergey Organov
2024-01-29 18:20                           ` Jeff King
2024-01-29 21:49                             ` Sergey Organov
2024-01-30  5:44                               ` Jeff King
2024-01-30  5:53                                 ` Junio C Hamano
2024-02-29 19:07 ` [PATCH] clean: improve -n and -f implementation and documentation Sergey Organov
2024-03-01 13:20   ` Jean-Noël Avila
2024-03-01 14:34     ` Sergey Organov
2024-03-01 15:29       ` Kristoffer Haugsbakk
2024-03-01 18:07         ` Junio C Hamano
2024-03-02 19:47       ` Jean-Noël AVILA
2024-03-02 20:09         ` Sergey Organov
2024-03-02 21:07           ` Junio C Hamano
2024-03-02 23:48             ` Sergey Organov
2024-03-03  9:54               ` Sergey Organov
2024-03-01 18:07     ` Junio C Hamano
2024-03-01 18:30       ` Junio C Hamano
2024-03-01 19:31       ` Sergey Organov
2024-03-02 16:31   ` Junio C Hamano
2024-03-02 19:59     ` Sergey Organov
2024-03-03  9:50   ` [PATCH v2] " Sergey Organov

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=87il3enc1i.fsf@osv.gnss.ru \
    --to=sorganov@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=newren@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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