Thread (1 message) 1 message, 1 author, 2024-01-23

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

From: Sergey Organov <hidden>
Date: 2024-01-23 15:10:59

Elijah Newren [off-list ref] writes:
On Tue, Jan 9, 2024 at 12:21 PM Junio C Hamano [off-list ref] wrote:
quoted
I think the current code makes "-n" take precedence, and ignores
"-f".
:-(
quoted
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help