Re: what should "git clean -n -f [-d] [-x] <pattern>" do?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Sergey Organov <sorganov@xxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux