svn commit: r368820 - head

Mark Millard marklmi at yahoo.com
Sat Dec 26 06:21:17 UTC 2020



> On 2020-Dec-24, at 21:17, Mark Millard <marklmi at yahoo.com> wrote:
> 
> Hartmann, O. o.hartmann at walstatt.org wrote on
> Thu Dec 24 21:34:56 UTC 2020 :
. . .

I've done more exploring and so am more willing to be
explicit about commands now that I've tried some of this.

>> I can not find (easily) any hints
>> for those who were familiar with subversion and checking out /usr/src either for
>> 12-STABLE, 12.1-RELENG, 12.2-RELENG, CURRENT.
> 

Presuming having each available at the same time in separate directory trees,
but only one repository, and sticking to the HEAD commit for each at the time
the local repository is updated from the remote one. Also presuming no locally
updated sources so there is nothing to clean up or put to the side . . .

https://github.com/bsdimp/freebsd-git-docs/blob/main/faq.md has as its first question:

"How do I track -current and -stable with only one copy of the repo?" So based
on that text . . .

The notations for the git branches for what you list are (in order):

stable/12
releng/12.1
releng/12.2
main

The later material will lead to there being 4 FreeBSD source trees (with my
arbitrary example paths that you might not want to use):

/usr/fbsd/freebsd-current/
/usr/fbsd/freebsd-stable-12/
/usr/fbsd/freebsd-releng-12.1/
/usr/fbsd/freebsd-releng-12.2/

When following the general structure that uses worktrees that is documented, you
can have at most one worktree for a branch. (Adding branches that you maintain
to be related to those allows for more.) I'll indicate one worktree for each but
main. main gets no worktree: it already has a sufficient context.

The initial setup (I picked an example URL):

# mkdir -p /usr/fbsd
# cd /usr/fbsd
# git clone -o freebsd --config remote.freebsd.fetch='+refs/notes/*:refs/notes/*' \
ssh://anongit@git.freebsd.org/src.git freebsd-current
# cd freebsd-current
# git checkout main
# git worktree add ../freebsd-stable-12 stable/12
# git worktree add ../freebsd-releng-12.1 releng/12.1
# git worktree add ../freebsd-releng-12.2 releng/12.2

Then, as an example of updating freebsd-current (the overall sequence follows
the FAQ but I'll note a variation later):

# cd /usr/fbsd/freebsd-current
# git checkout main
# git pull --ff-only

Note: For the below, the above needs to have been
done first: the pull involves the fetch of the
remote material, including for the use in the
below.

# cd ../freebsd-stable-12
# git merge --ff_only freebsd/stable/12
# cd ../freebsd-releng-12.1
# git merge --ff_only freebsd/releng/12.1
# cd ../freebsd-releng-12.2
# git merge --ff_only freebsd/stable/12

I'll note that elsewhere it is recommended to do (once
for each login using git for FreeBSD source activity):

# git config --global pull.ff only

because those --ff-only uses are important to keeping
history as FreeBSD intends it (linear) and --ff-only
can be a default. (This will not cover the below
variation.)


The variation that I mentioned follows . . .

You might not like needing to update freebsd-current in
order to update, say, freebsd-stable-12 above. Avoiding
the pull and using the analogous two commands in the
proper order gives the following that only update the
individual part of the fetch that was of interest.

I show binding to branches to directories explicitly
(checkout) but such would not be needed unless the
binding for the directory tree had been changed. Note
that the below is not using pull and so the config
above does not cause --ff-only defaults to be involved:
Be reliably explicit.


# cd /usr/fbsd/freebsd-current
# git fetch freebsd
# git checkout main
# git merge --ff-only freebsd/main

vs.

# cd /usr/fbsd/freebsd-current
# git fetch freebsd
# cd /usr/fbsd/freebsd-stable-12
# git checkout stable/12
# git merge --ff-only freebsd/stable/12

vs.

# cd /usr/fbsd/freebsd-current
# git fetch freebsd
# cd /usr/fbsd/freebsd-releng-12.1
# git checkout releng/12.1
# git merge --ff-only freebsd/releng/12.1

vs.

# cd /usr/fbsd/freebsd-current
# git fetch freebsd
# cd /usr/fbsd/freebsd-releng-12.2
# git checkout releng/12.2
# git merge --ff-only freebsd/releng/12.2


Note: After a fetch, one or more of the
cd-checkout-merge sorts of sequences could
be done without re-fetching.

Part of what a "merge --ff-only" does is to
move what the active branch refers to, in
the cases above, to a (potentially) new place
in newly fetched material.

I hope that the above helps. It does not deal with
picking out a specific commit out of the repository
for a specific source directory tree. I do not know
if you do such and it makes controlling the context
more complicated to describe.

Not tied to that, you may want to look at:

https://github.com/bsdimp/freebsd-git-docs/blob/main/SUMMARY.md

that organizes the existing material and may make
it easier to pick out things to read.

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



More information about the svn-src-head mailing list