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

From:
Matthias Schmidt <openbsd@xosc.org>
Subject:
Re: Smartest way to rename?
To:
gameoftrees@openbsd.org
Date:
Sun, 5 May 2024 12:09:56 +0200

Download raw body.

Thread
Hi Stefan,

* Stefan Sperling wrote:
> On Sun, May 05, 2024 at 09:57:07AM +0200, Matthias Schmidt wrote:
> > Hi everyone,
> > 
> > is
> > 
> > $ cp A B
> > $ got add B
> > $ got remove A
> > $ got ci
> > 
> > the smartest way to rename A to B?
> 
> Not the smartest way, but the only way at present.
> 
> > I checked got(1) and gotadmin(1) and couldn't find anything similar to git's mv.
> > Maybe it's worth to add something to the EXAMPLES section?
> 
> If users see "move" or "rename" they will (reasonbly) expect an atomic
> move/rename operation to occur which then seamlessly carries over into
> all update/merge operations. But Got cannot do this yet.

Thanks for the explanation, makes sense.  Since I checked the man pages
and couldn't find a reference maybe the following diff could be
helpful.

Cheers

	Matthias

diff /tmp/got
commit - c811fd62d1fbec7ac5e58e10b242c3d4f8b4cdb4
path + /tmp/got
blob - adc1a793e253541b83360e9a96a100b0dfcebe65
file + got/got.1
--- got/got.1
+++ got/got.1
@@ -4255,6 +4255,15 @@ Changes for any accepted pull requests will still appe
 .Dq refs/remotes/upstream/master,
 regardless of which branch was used in the forked repository to
 create a pull request.
+.Pp
+.Nm
+doesn't offer an atomic move or rename command yet.
+To rename a file, it has to be copied, added and then removed.
+.Pp
+.Dl $ cp oldfile.c newfile.c
+.Dl $ got add newfile.c
+.Dl $ got remove oldfile.c
+.Dl $ got commit newfile.c oldfile.c
 .Sh SEE ALSO
 .Xr gotadmin 1 ,
 .Xr tog 1 ,