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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: got: rm * removes current directory
To:
Omar Polo <op@omarpolo.com>
Cc:
Mikhail <mp39590@gmail.com>, gameoftrees@openbsd.org
Date:
Mon, 29 May 2023 20:06:12 +1000

Download raw body.

Thread
On 23-05-29 11:46AM, Omar Polo wrote:
> On 2023/05/29 19:26:47 +1000, Mark Jamsek <mark@jamsek.com> wrote:
> > tbh, I think stsp's proposed change is a notable improvement over the
> > current behaviour--which is surprising imo. Purely from a POLA
> > perspective, I think we should go ahead with it. The added consistency
> > with both the filesystem layer and other VCSs (Fossil also leaves the
> > directory), and I think it is a definite improvement. (That's not to say
> > we should do things just to be the same as others, but that, in this
> > case, they have the right idea.) And then when you consider the target
> > audience, as stsp noted, this will invariably pop up again.
> 
> just to be clear, assuming a repository and a worktree with the
> following entries:
> 
> 	README
> 	foo/bar.c
> 	foo/x.y
> 
> what do you expect after doing "got rm foo/bar.c foo/x.y" ?
> 
> With the proposed diff "foo" will be removed as it only affect what
> "cd foo && got rm bar.c x.y" does, leaving foo around as a special
> case to avoid removing the current working directory.  This is the
> quirk I don't like, but it's personal preference.
> 
> If everything, I'd prefer if we settle on "got rm foo/bar.c foo/x.y"
> leaving "foo" around (which is what I assume jamsek intended), it
> would be coherent with rm and don't have any special case.  It could
> be tricky though, as with "got rm -R foo" I'd expect foo to be deleted
> as well.

Yes, you are right. I would expect what you describe: 'foo' remains on
disk.

So irrespective of whether `got rm`ing all the files of a subdir from
within that directory or from above that directory, the directory will
remain.

In that case, I agree with your aversion to the quirk.

> Since I made a big mess out of this thread (apologize again) I
> wouldn't mind trying to implement this behaviour, assuming we all
> agree.

Please don't apologise! I think it is great to hear different opinions
and whether I agree with yours or not--to be fair, I think I agree with
your position 99% of the time--I _always_ learn something when I read
your thoughts so I would prefer you keep expressing them :)

And, yes please! If you or stsp or anyone is happy to cook a diff,
I think this change will be a worthwhile improvement. (Also, sorry to
not offer to do this myself. Final exam on Friday then there are a few
things I can't wait hack on Got :)

-- 
Mark Jamsek <fnc.bsdbox.org|got.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68