Re: what should "git clean -n -f [-d] [-x] <pattern>" do?
- From
Sergey Organov <sorganov@gmail.com>
- Date
- Jan 23, 2024, 15:10 UTC
- Message-ID
- <87a5ow9jb4.fsf@osv.gnss.ru>
- In-Reply-To
- <CABPp-BHUVLS4vB5maZzU5gS33ve6LkKgij+rc1bBZges6Xej-g@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 13 quoted lines
> On Tue, Jan 9, 2024 at 12:21 PM Junio C Hamano <gitster@pobox.com> wrote: >> >> I think the current code makes "-n" take precedence, and ignores >> "-f". > > :-( > >> 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? > > I believe so.
Then how does one figure what "git clean -f -f" will do without actually doing it?
Please notice that -f -f is special according to the manual:
"Git will refuse to modify untracked nested git repositories (directories with a .git subdirectory) unless a second -f is given."
I looks like neither (0), nor (1) nor (2) gives us any useful behavior in this case.
I figure the best solution is to rather make -n orthogonal to -f, that will solve the puzzle, and that is what actually expected from a "dry run" option: don't change any behavior, except print actions instead of performing them.
-- Sergey Organov