"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: got: rm * removes current directory
To:
Stefan Sperling <stsp@stsp.name>
Cc:
Mikhail <mp39590@gmail.com>, gameoftrees@openbsd.org
Date:
Sun, 28 May 2023 20:33:20 +0200

Download raw body.

Thread
On 2023/05/28 19:26:48 +0200, Stefan Sperling <stsp@stsp.name> wrote:
> On Sun, May 28, 2023 at 05:11:07PM +0200, Omar Polo wrote:
> > On 2023/05/28 12:59:39 +0200, Stefan Sperling <stsp@stsp.name> wrote:
> > Don't know, I'm not sure we should be using $PWD in lib/ to change the
> > behaviour, although removing $PWD is not nice.
> > 
> > Admittedly I haven't noticed the issue so far and won't consider it a
> > bad thing anyway, as it did what it is supposed to do.
> 
> Another point of concern is that the current behaviour of got rm
> contradicts the behaviour of /bin/rm.
> 
> /bin/rm does not allow the removal of "." or "..", and rm * will never
> result in the removal of "."

but even with this 'got rm' doesn't match rm.  It just adds a quirks
for the current working directory but otherwise keeps removing empty
ones, right?  I don't like quirks that much fwiw.

rm and 'got rm' work on two different levels: one at the filesystem
level, where both files and directories are tracked, the other at the
"git view" of the filesystem, where only file exists and directories
are a byproduct.  I don't think there's much worth in trying to keep
these two tools behaving the same but if we want to, then 'got rm'
should keep directories around unless -R.

(do we need got rmdir too then? :P)

On the other hand we could add an option, say -P to wink at cvs, to
avoid pruning empty directories, but I don't like the idea either to
be fair.  Noone will use it and we'll only have more code to maintain
and more words in the manpage.

I feel like the current behaviour is the one that sucks less.

> Removal of "." via 'got rm *' can catch users by surprise for this reason.

agree