Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2021 18:04:45 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        Milan Obuch <freebsd-git@dino.sk>
Cc:        freebsd-git@freebsd.org
Subject:   Re: git setup/usage question
Message-ID:  <29570D03-7BDF-4778-8E5A-9CD4E03C4D76@yahoo.com>
In-Reply-To: <A448C932-50C3-4E93-B4CA-8A770C9876DE@yahoo.com>
References:  <CCD9FAB7-7075-43F8-989B-78CC14091913.ref@yahoo.com> <CCD9FAB7-7075-43F8-989B-78CC14091913@yahoo.com> <20210126231347.0d7c5a77@zeta.dino.sk> <A448C932-50C3-4E93-B4CA-8A770C9876DE@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2021-Jan-26, at 15:15, Mark Millard <marklmi at yahoo.com> wrote:

> On 2021-Jan-26, at 14:13, Milan Obuch <freebsd-git at dino.sk> wrote:
>=20
>> On Tue, 26 Jan 2021 12:51:43 -0800, Mark Millard <marklmi at =
yahoo.com>
>> wrote:
>>=20
>>> Milan Obuch freebsd-git at dino.sk wrote on
>>> Tue Jan 26 14:10:29 UTC 2021 :
>>>=20
>>>> # git clone --config
>>>> remote.freebsd.fetch=3D'+refs/notes/*:refs/notes/*' --bare
>>>> https://git.freebsd.org/src.git /mnt/src/.git # git -C
>>>> /mnt/src/.git worktree add /mnt/src/main main # git -C
>>>> /mnt/src/.git worktree add /mnt/src/13 stable/13 # git -C
>>>> /mnt/src/.git worktree add /mnt/src/12 stable/12 # git -C
>>>> /mnt/src/.git worktree add /mnt/src/11 stable/11 =20
>>> . . .
>>>> # git -C /mnt/src/.git merge
>>>> fatal: this operation must be run in a work tree
>>>>=20
>>>> I am a bit stuck now. What does it mean 'being in a work tree'?
>>>> Doing 'cd /mnt/src/main' or similar before git command does not
>>>> change anything. I read 'man git-merge' but still no clue. It must
>>>> be something simple, I just do not see it. =20
>>>=20
>>> man git reports:
>>>=20
>>>      -C <path>
>>>          Run as if git was started in <path> instead of the current
>>> working directory. . . .
>>>=20
>>> So it looks to me like you need to do one or
>>> more of something like:
>>>=20
>>> # git -C /mnt/src/main merge
>>> # git -C /mnt/src/stable/13 merge
>>> # git -C /mnt/src/stable/12 merge
>>> # git -C /mnt/src/stable/11 merge
>>>=20
>>> /mnt/src/.git is not a working directory.
>>>=20
>>=20
>> [ snip ]
>>=20
>> Thanks for hints, this does explain a bit from what I see, however
>> something is still missing.
>=20
> By the way, the modern version of Warner's documentation
> is at:
>=20
> https://github.com/bsdimp/freebsd-git-docs/
>=20
> and is the basis for the documentation update FreeBSD
> will have in this area.
>=20
> In the Cloning and Mirroring section of:
>=20
> https://github.com/bsdimp/freebsd-git-docs/blob/main/faq.md
>=20
> there is a little material about issues with using pare repos.
> The Users section basically says that using bare will not be
> documented. (I've never tired to use a bare repo.)
>=20
>> When I tried what you wrote
>>=20
>> # git -C /mnt/src/main merge
>>=20
>> or what I made from reading man pages and Git Book referenced in Git
>> Primer,
>>=20
>> # git -C /mnt/src/.git --work-tree /mnt/src/main merge
>>=20
>> all I get is
>>=20
>> fatal: No remote for the current branch.
>=20
> The "No staged changed migration" section of:
>=20
> https://github.com/bsdimp/freebsd-git-docs/blob/main/src-cvt.md
>=20
> reports on using the following to clone with the ref/notes related
> material included:
>=20
> git clone -o freebsd --config =
remote.freebsd.fetch=3D'+refs/notes/*:refs/notes/*' =
https://git.freebsd.org/src.git freebsd-src
>=20
> Note the "-o freebsd" that you did not use. The coning notes
> in:
>=20
> https://github.com/bsdimp/freebsd-git-docs/blob/main/mini-primer.md
>=20
> also use the "-o freebsd" (but not the refs/notes related material).
>=20
>> so evidently no merge is actually done. Something in my setup is =
wrong
>> or missing. It's late here now, tomorrow will be another day to try
>> something :)
>=20
> I recommend reading:
>=20
> https://github.com/bsdimp/freebsd-git-docs/blob/main/mini-primer.md
> and:
> https://github.com/bsdimp/freebsd-git-docs/blob/main/src-cvt.md
>=20
> and in using the conventions documented, such as result from
> "-o freebsd".


Something that I wonder about your use of -C /mnt/src/.git . . .

There is also --git-dir=3D/mnt/src/.git . I wonder if you always
should be using -C or if some or all the time you should be using
--git-dir=3D

QUOTE
       --git-dir=3D<path>
           Set the path to the repository (".git" directory). This can =
also be
           controlled by setting the GIT_DIR environment variable. It =
can be
           an absolute path or relative path to current working =
directory.

           Specifying the location of the ".git" directory using this =
option
           (or GIT_DIR environment variable) turns off the repository
           discovery that tries to find a directory with ".git" =
subdirectory
           (which is how the repository and the top-level of the working =
tree
           are discovered), and tells Git that you are at the top level =
of the
           working tree. If you are not at the top-level directory of =
the
           working tree, you should tell Git where the top-level of the
           working tree is, with the --work-tree=3D<path> option (or
           GIT_WORK_TREE environment variable)

           If you just want to run git as if it was started in <path> =
then use
           git -C <path>.
END QUOTE

There is also the issue of using =3D or not for the likes of:

--work-tree=3D/mnt/src/main
or:
--git-dir=3D/mnt/src/.git

The man page always lists =3D for those two (not for -C use).

QUOTE
       --work-tree=3D<path>
           Set the path to the working tree. It can be an absolute path =
or a
           path relative to the current working directory. This can also =
be
           controlled by setting the GIT_WORK_TREE environment variable =
and
           the core.worktree configuration variable (see core.worktree =
in git-
           config(1) for a more detailed discussion).
END QUOTE


=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?29570D03-7BDF-4778-8E5A-9CD4E03C4D76>