From: Sergey Organov <sorganov@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: what should "git clean -n -f [-d] [-x] <pattern>" do?
Date: Wed, 10 Jan 2024 01:04:45 +0300 [thread overview]
Message-ID: <877ckitb7m.fsf@osv.gnss.ru> (raw)
In-Reply-To: <xmqq34v6gswv.fsf@gitster.g> (Junio C. Hamano's message of "Tue, 09 Jan 2024 12:20:48 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> I think the current code makes "-n" take precedence, and ignores
> "-f".
To me it rather looks more like "-n" implies "-f", but then there is
"second -f" rule that makes things even more interesting:
"Git will refuse to modify untracked nested git repositories
(directories with a .git subdirectory) unless a second -f is given."
How do I figure what files will be deleted on
git clean -f -f
when "-n" behaves as you (or me) described? I.e., what
git clean -f -f -n
and
git clean -f -n
will output?
>
> Shouldn't it either
>
> (1) error out with "-n and -f cannot be used together", or
> (2) let "-n" and "-f" follow the usual "last one wins" rule?
>
> The latter may be logically cleaner but it is a change that breaks
> backward compatibility big time in a more dangerous direction, so it
> may not be desirable in practice, with too big a downside for a too
> little gain.
I agree (2) is too dangerous and surprising, and (1) is limiting: I
believe the user should be able to see what will be done on
git clean -f -f
by simply adding "-n" to the command-line.
So I figure I'd rather prefer yet another option:
(3) -n dry run: show what will be done once "-n" is removed.
This way, e.g.,
git clean
and
git clean -n
will produce exactly the same output with default configuration:
fatal: clean.requireForce defaults to true and neither -i, nor -f given; refusing to clean
and one will need to say, e.g.:
git clean -n -f
to get the list of files to be deleted with "git clean -f".
With (3) "-n" becomes orthogonal to "-f", resulting in predictable and
useful behavior.
BR,
-- Sergey Organov
next prev parent reply other threads:[~2024-01-09 22:05 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 [this message]
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
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877ckitb7m.fsf@osv.gnss.ru \
--to=sorganov@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).