Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2020 08:34:02 -0700
From:      David Wolfskill <david@catwhisker.org>
To:        Ulrich =?iso-8859-1?Q?Sp=F6rlein?= <uqs@freebsd.org>
Cc:        Ed Maste <emaste@freebsd.org>, git@freebsd.org
Subject:   Re: Question on (my) workflow migration svn -> git
Message-ID:  <20201005153402.GA1349@albert.catwhisker.org>
In-Reply-To: <20201005150312.GQ92039@acme.spoerlein.net>
References:  <20200924201715.GR1390@albert.catwhisker.org> <20200924205326.GB64154@spindle.one-eyed-alien.net> <CAJ9axoR=0zPxUSF-wH-ZT%2BeeHN3-ZB%2B=M6NcbWR1zKncU2m%2BKA@mail.gmail.com> <20200926020946.GK1390@albert.catwhisker.org> <20200926124212.GL92039@acme.spoerlein.net> <20201003223531.GA77534@albert.catwhisker.org> <CAPyFy2AfGFQJJpjKkhkUzbXPyDbPQnDuYp-H7ko3aDRcHh1sFA@mail.gmail.com> <20201004180342.GB1349@albert.catwhisker.org> <20201005150312.GQ92039@acme.spoerlein.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--ofekNuVaYCKmvJ0U
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Oct 05, 2020 at 05:03:12PM +0200, Ulrich Sp=F6rlein wrote:
> ...
> > Sure -- and I (at least half-)expected that: I am experimenting, so at
> > this stage, I expect a loty of stuff to be tried and tossed.
>=20
> David, I'm not sure what "unhappiness" you were referring to. I just
> updated the bare repo from my stable_12 worktree that I've created last
> time.

Unfortunately, I failed to run it within script(1), so I don't have a
record, but the attempt to fetch (on the "bare" (but not "mirror") repo
failed.

As noted, when I re-created the repo, I created it as a "mirror"...
which (based on your comments beliw) appears to have been a fairly
reasonable thing to do. :-)

> ...
> What I tried:
>=20
> % cd /tmp/stable_12
> % git fetch   # takes some time, downloads 1GiB ...
> Receiving objects: 100% (2734600/2734600), 1.04 GiB | 2.90 MiB/s, done.
> Resolving deltas: 100% (2119516/2119516), completed with 368 local object=
s.
> From https://cgit-beta.freebsd.org/src
>  * branch                    HEAD       -> FETCH_HEAD
>=20
> This is a bit worrying, as it did not update any of the refs, so it's
> borderline useless. A `git pull` instead of fetch will spew out a grant
> massive diff though and churn like mad. ^C ^C
>=20
> So we need to properly update our "upstream" bare repo first:
> % cd /tmp/src.git
> % git fetch -pP
>=20
> That downloads everything again, which isn't surprising as it doesn't
> know about all the other refs that were already fetched, and also
> because the server offers that all in 1 giant packfile and I guess it
> doesn't re-compress and encode things on the fly :/
>=20
> Turns out that refuses to clobber existing tags, so I run it again with
> --force. Still no luck with refs, turns out this wasn't a --mirror
> clone, so I add `mirror =3D true` and `fetch =3D +refs/*:refs/*` under its
> remote section.

Aye; I had noted the parts (from "git help clone") about how "--mirror"
handles all branches and refs, and figured that would be a Good Thing
for my use case.

> % git fetch --force --all
> ...
> aaahh, that finally gets me all the refs into a proper mirror bare repo.

:-)  So far (2 out of 2 tries, so take it with a "grain of salt") mere
"git fetch --all" seems to be adequate for the mirror repo.

> Back to stable/12 workspace and force a checkout to stable/12, even
> though due to hash re-spinning it is something "totally" unrelated.
>=20
> % cd /tmp/stable_12
> % git status  # will list how we are so, so different from what is now
>               # stable/12 in our local upstream bare repo that we share
>               # refs with
> % git reset --hard stable/12   # yolo, get us stable/12 no matter what
>                                # we have to throw away

In practice, I find that I do not need to specify the target branch --
just "git reset --hard" appears to be adequate.

> So there you have it. No need to throw away your existing bare repo, but
> starting out with a --mirror clone would've made things easier.

So I am seeing.  So it's good that this is documented, after a fashion.

> Then you need to keep in mind git never wants to throw away any diffs
> you might have, and we might get 1 or 2 more massive "diffs" due to
> different hashes till the final switch over date.

Aye.  For now, I'll:

* Continue using svn for actually updating the sources I use to keep my
  systems up-to-date.

* Experiment with setting something up to update my local private git
  mirror repo on a daily basis, as well.

* Start running some comparisonsa -- and, with luck, build some
  confidence that the use of git may work for me.

> As you want a read-only mirror/checkout of this, you can just forcefully
> `reset --hard` the workspace to whatever git hash or reference you
> fancy.

Well, the mirror repo is read-only.  I do mess with the working copy
(e.g. for experimenting with patches after I've reported an issue).

I also rely on having mt kernel config file represented in the source
tree by a symlink to a different hierachy of files under separate
revision control, so that could also prove to become "interesting."
>=20
> > > Deleting and cloning again from scratch is a reasonable way to
> > > interact with the repository during this stage.
> > ...
> > > For the time being I think that you'd want to remove the bare repo and
> > > worktrees, and recreate everything from scratch over a hash change.
>=20
> Not really required, but you need to understand the data model to be
> able to dig your clone out of that mess.

Fair, but given that it was a "scratch" repo anyway, blowing the old one
away and re-creating (as a real "mirror") appears to have worked well in
this case.

> > And that part's fine.
> >=20
> > Where I'm having a problem is for the (usual) case of "no hash change",
> > but there have been commits to the source-of-truth: it appears that "git
> > fetch --all" copies those to my local private mirror, but I don't see
> > how to get my "worktree" updated.
>=20
> In your stable_12 workspace, you should be able to do this normally with
> `git pull origin stable/12`, but that is a) not going to work while we
> respin hashes and b) overkill, as you don't even want any of the
> safeguards. So in short:
>=20
> - in your bare --mirror clone: git fetch (--force)

Aye.

> - in your workspace: git reset --hard stable/12

Aye (though as noted above, the target branch appears to be superfluous).

> This is not expected to make sense

That is actually a fairly large relief to see.... :-}

> Uli

Thanks again -- I think we're actually closing in on a solution (for my
case).

Peace,
david
--=20
David H. Wolfskill				david@catwhisker.org
"the end of the pandemic is in sight" -- Donald Trump (while infected
with SARS-COV-2)

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

--ofekNuVaYCKmvJ0U
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEE4owz2QxMJyaxAefyQLJg+bY2PckFAl97POpfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEUy
OEMzM0Q5MEM0QzI3MjZCMTAxRTdGMjQwQjI2MEY5QjYzNjNEQzkACgkQQLJg+bY2
PcmVrwf9G8ahOLaHUXxJjl9gH9GZ2XXjLjDNPJfaWq+3V7tQASJOSl31+wL0REG1
ah1oizPlVGh1ZtBPz0I46sD73oVgy2qKXHroSsVZei5Ka/Sj630ZygbTnInhEEIO
oCZSH4iJ5y/zQOic0lApIo87C22tIEe7e9c9lrk+gD8SAeTFfza4/ngkq/SGenD0
lVs8xC91ni7SEqEaQFwq5Pn1ZkspKr7WjcgSEeMVVzptCAsFXyOI0hBsS2zeMN1+
iXFgAOeDEp1/G9ki+oloPDY4wVGcyNdX3Rm+V77zLDPVU67gk1io4RwuojuFNxU+
gd57eCuSHaqzwzHDsRgap2aRSxMtTg==
=oF9f
-----END PGP SIGNATURE-----

--ofekNuVaYCKmvJ0U--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20201005153402.GA1349>