Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2021 12:51:43 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        freebsd-git@dino.sk, freebsd-git <freebsd-git@freebsd.org>
Subject:   Re: git setup/usage question
Message-ID:  <CCD9FAB7-7075-43F8-989B-78CC14091913@yahoo.com>
References:  <CCD9FAB7-7075-43F8-989B-78CC14091913.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Milan Obuch freebsd-git at dino.sk wrote on
Tue Jan 26 14:10:29 UTC 2021 :

> # 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
. . .
> # 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.

man git reports:

       -C <path>
           Run as if git was started in <path> instead of the current =
working
           directory. . . .

So it looks to me like you need to do one or
more of something like:

# 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

/mnt/src/.git is not a working directory.

Note that

# git -C /mnt/src/.git log

has the same sort of issue.

The other commands that you list (clone, worktree add,
worktree list, fetch) do not depend on having some
specific, pre-existing worktree (working directory) as
context for those operations. For those, referencing
the .git directory tree works.

/mnt/src/main , /mnt/src/stable/13 , /mnt/src/stable/12 ,
and /mnt/src/stable/11 all include information pointing
to /mnt/src/.git as what they are tied to. So they tend
to also work where /mnt/src/.git references are okay.

=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?CCD9FAB7-7075-43F8-989B-78CC14091913>