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

From:
sylvain@saboua.me
Subject:
Re: git add equivalent – add only selected files
To:
Stefan Sperling <stsp@stsp.name>
Cc:
Gameoftrees <gameoftrees@openbsd.org>
Date:
Thu, 06 Mar 2025 17:58:46 +0100

Download raw body.

Thread
On 2025-03-06 16:47, Stefan Sperling wrote:
> On Thu, Mar 06, 2025 at 12:41:05PM +0100, sylvain@saboua.me wrote:
>> I incepted my worktree by following some reddit's user advice
>> which had worked for me a few years ago when I started rfdupes:
>> https://www.reddit.com/r/openbsd/comments/1b7wl8h/
>> 
>> The trouble is very simple, for a start : how is `got' supposed to
>> know where to look for a repository to add the files to ?
>> 
>> The error is the following:
>> 
>> $ pwd
>> /var/www/got/public/saboua.xyz
>> $ got add /var/www/htdocs/saboua.xyz/doc/*.css
>> got: 'got add'needs a work tree in addition to a git repository
>> Work trees can be checked out from this Git repository with 'got 
>> checkout'.
>> The got(1) manual page contains more information.
> 
> Got infers a work tree path from the current working directory.
> 
> In your case 'got add' tries to find a work tree by checking whether 
> any
> of these directories contain a valid .got directory:
> 
>   /var/www/got/public/saboua.xyz
>   /var/www/got/public/
>   /var/www/got/
>   /var/www/
>   /var/
> 

I get it ! I must have made a mistake, my .got folder was in
/var/www/got/public/doc
Moved it back somewhere else and did the commit but now there's
TWO doc/ folders nested ... see
https://got.saboua.xyz/?action=tree&commit=9091e34d04244b595ada7671cc74f4fa5b3c8428&folder=%2Fdoc&path=saboua.xyz

I think I'll delete the folder and start again, the mistake is mine
not yours guys ;'/

> None of these contain a .got directory so no work tree is found and
> the above error is raised.
> 
> Assuming you have previously checked out a work tree at the path
> /var/www/htdocs/saboua.xyz/ then using this sequence instead should 
> work:
> 
>  $ cd /var/www/htdocs/saboua.xyz
>  $ got add doc/*.css
>  $ got commit
> 

For reference:
$ find / -type d -name .got
/home/sylvain/.got                        # configuration folder
/home/sylvain/hack/rfdupes/.got           # rfdupes
/home/sylvain/sylvain.sab.free.fr/.got    # first 14yo website 
(available on my got web srv)
/home/bkup/dotfiles/home/sylvain/.got     # configuration folder backed 
up
/var/www/got/public/tar/.got              # old rfdupes worktree
/var/www/got/public/tar/rdfupes.git/.got  # new rfdupes worktree
/var/www/htdocs/.got                      # this is the one I moved from 
doc/

> It seems we have a documentation problem. Some commands require a Git
> repository while other commands require a Got work tree.
> 
Yes. GoT, the CVS service with only one error in a long series
of flawless manpages ? ;)

> For commands which require a repository we have the -r option and we
> document how a repository will be found if this option is omitted.
> 
> However, we do not document how commands such as 'got add' will find
> their work tree,
> 
> Except in the section of 'got info', where the got(1) manual says:
> 
>                The work tree to use is resolved implicitly by walking 
> upwards
>                from the current working directory.
> 
> Would having this sentence in the documentation of 'got add' have 
> helped you?
> 
It would. Maybe I could also discuss (not that much)
the ordering of the options in the DESCRIPTION section if
one assumes that they're not (entirely) up to taste.

Regards,
Sylvain Saboua