Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 2020 17:59:51 +0200
From:      =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= <uqs@freebsd.org>
To:        Ed Maste <emaste@freebsd.org>
Cc:        freebsd-git@freebsd.org
Subject:   Re: Next odd commit affecting `git subtree split` experiments with contrib/elftoolchain
Message-ID:  <CAJ9axoS-VSQm%2B8_NLYJ%2BvURmH2CDteYMYHsFbf%2BCfyDjCcCPdw@mail.gmail.com>
In-Reply-To: <CAPyFy2BLM4=n4gbmfy19Vbo4c7c1JUYhB6MDTsJeU%2BLMEsfEmw@mail.gmail.com>
References:  <CAPyFy2DR6R4S7kgkRtrWzPBuD_6QR=A_hU=sP%2BLm==Y61AKhsA@mail.gmail.com> <CAPyFy2BLM4=n4gbmfy19Vbo4c7c1JUYhB6MDTsJeU%2BLMEsfEmw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 17, 2020 at 4:25 AM Ed Maste <emaste@freebsd.org> wrote:

> On Tue, 16 Jun 2020 at 14:41, Ed Maste <emaste@freebsd.org> wrote:
> >
> > I've found one new class of strange commit - r265044, which I've
> > excluded from mergeinfo parsing (in the above list). However, svnweb
> > highlights an issue:
>

I've built a repo w/o the MFHead commits going into project branches. That
is, projects will merge into head, but head will *not* merge into projects.

Running the subtree split, I get a history with about 437 commits. I see in
your https://github.com/emaste/elftoolchain/tree/split-from-cgit-beta that
you only end up with 277 commits (if that display is to be trusted).

For this repo, it now looks like so (r265044 is from 2014-04-28)

* | | | | | | | 52046640c377 - Merge from head (Baptiste Daroussin, 4
years, 9 months ago, 2015-10-01)
* | | | | | | | 7d76ac023498 - Finish merging from head, messed up in
previous attempt (Baptiste Daroussin, 4 years, 9 months ago, 2015-09-12)
* | | | | | | | 184614fff731 - Merge from head (Baptiste Daroussin, 4
years, 9 months ago, 2015-09-12)
* | | | | | | | 06d2968292d4 - Merge from head@274131 (Baptiste Daroussin,
5 years ago, 2015-06-16)
|\| | | | | | |
| * | | | | | |   a8f362c5fe90 - Add META_MODE support. (Simon J. Gerraty,
5 years ago, 2015-06-13)
| |\ \ \ \ \ \ \
| | * | | | | | | 670c2113728e - Merge sync of head (Simon J. Gerraty, 5
years ago, 2015-05-27)
| | * | | | | | | 045693fbc721 - Merge from head@274682 (Simon J. Gerraty,
6 years ago, 2014-11-19)
| | * | | | | | | d3282ab267a8 - Merge head (Simon J. Gerraty, 6 years ago,
2014-04-28)
| |  / / / / / /
| * | | / / / / 0233f02a35bc - elfcopy: Handle objects without a
".shstrtab" section string table (Ed Maste, 5 years ago, 2015-06-13)
| | |_|/ / / /
| |/| | | | |
| * | | | | | 01a7e6868f7a - Update to ELF Tool Chain r3223 (Ed Maste, 5
years ago, 2015-05-27)
| | |/ / / /
| |/| | | |
| * | | | | 356943f64b09 - Update to ELF Tool Chain r3197 (Ed Maste, 5
years ago, 2015-05-14)
| * | | | |   2dae10c39647 - Merge ^/projects/release-arm-redux into
^/head. (Glen Barber, 5 years ago, 2015-05-09)
| |\ \ \ \ \
| | * | | | | bb93d386e833 - MFH: r280643-r281852 (Glen Barber, 5 years
ago, 2015-04-22)
| | * | | | | fad1f163a320 - MFH: r278968-r280640 (Glen Barber, 5 years
ago, 2015-03-25)
| | * | | | | d2f00e64668a - MFH: r278593-r278966 (Glen Barber, 5 years
ago, 2015-02-18)
| | * | | | | 0a8b1fb8842b - MFH: r278202,r278205-r278590 (Glen Barber, 5
years ago, 2015-02-11)
| | | |/ / /
| | |/| | |
| * | | | | cd6104d28a5c - Update elftoolchain to upstream revision 3179
(Ed Maste, 5 years ago, 2015-04-01)
| | |_|_|/
| |/| | |
| * | | |   14a1bbced50b - Merge ^/head r279163 through r279308. (Dimitry
Andric, 5 years ago, 2015-02-26)

So this is clearly not ideal yet. All MFH are there as cherrypicks and the
merges to head from unrelated branches still gets pulled in. A potential
post-processing step could be to squash subsequent commits with the same
tree hash.

Here, the 2nd hash is the tree hash:

   * 9b32ed0c66ef 74ab27147825  - elftoolchain nm(1): Initialize allocated
memory before use (Conrad Meyer, 2 years, 3 months ago, 2018-03-16)
*   5c976b8c4811 1d39238f5607  - Merge ^/head r327886 through r327930.
(Dimitry Andric, 2 years, 5 months ago, 2018-01-13)
|\
| * 344ba1731347 1d39238f5607  - elfcopy: copy raw (untranslated) contents
to binary output (Ed Maste, 2 years, 5 months ago, 2018-01-02)
* | 3714d762a9e0 1d39238f5607  - Merge ^/head r327341 through r327623.
(Dimitry Andric, 2 years, 5 months ago, 2018-01-06)
|/
* db9ffaaa5457 c3635117b95c  - readelf: report byte size for
DT_PREINIT_ARRAYSZ (Ed Maste, 2 years, 6 months ago, 2017-12-26)
*   a616bc1dbec6 c1e10d6f9540  - Merge ^/head r326132 through r326161.
(Hans Petter Selasky, 2 years, 7 months ago, 2017-11-24)
|\
| *   899122e1d197 c1e10d6f9540  - MFhead@r323646 (Enji Cooper, 2 years, 9
months ago, 2017-09-16)
| |\
| | * 09fe4662fc65 c1e10d6f9540  - Add missing newline after unknown
MIPS-specific dynamic entries. (John Baldwin, 2 years, 9 months ago,
2017-09-15)
| | * a27ad9741c63 2bdfff10c1e6  - Recognize NT_PTLWPINFO and NT_ARM_VFP in
FreeBSD ELF cores. (John Baldwin, 2 years, 9 months ago, 2017-09-14)
| * | 1e46d0a611f7 c1e10d6f9540  - MFhead@r323635 (Enji Cooper, 2 years, 9
months ago, 2017-09-16)
| * | 8caa235148b3 2200cd80945d  - MFhead@r322515 (Enji Cooper, 2 years, 10
months ago, 2017-08-14)
| |\|
| | * 81c051e299b3 2200cd80945d  - o Replace __riscv__ with __riscv o
Replace __riscv64 with (__riscv && __riscv_xlen == 64) (Ruslan Bukin, 2
years, 10 months ago, 2017-08-07)
| * | da88e12ed370 2200cd80945d  - MFhead@r322451 (Enji Cooper, 2 years, 10
months ago, 2017-08-13)
| * | 48461537238e b6e4a7671e42  - MFhead@r321431 (Enji Cooper, 2 years, 11
months ago, 2017-07-24)
| |\|

I'm not sure whether it would be straightforward to squash the right
commits and keep
the ones with the proper commit message. Your repo still has a view MFH
commits that
one might want to remove. Using git `filter-repo` might do the trick ...


> I've now successfully used Tom Clarkson's patched git subtree[1] to
> split elftoolchain out of cgit-beta, keeping the vendor branch history
> intact, and avoiding the extraneous and bogus commits.
>
> I used https://cgit-beta.freebsd.org/src.git at
> 4c09cab462f2d27794d51a4dcb06df806dc9f3a6, and performed the following
> steps:
>
> % git log contrib/elftoolchain
>
> 1. Observe that the initial commit under that prefix is:
>
> commit f4b5186d24f3e1969c32a49f126c8ad29ece63e9
> Merge: 8b06418614b0 5265ace0e440
> Author: Kai Wang <kaiw@FreeBSD.org>
> Date:   Wed Jan 15 22:30:48 2014 +0000
>
>     Copy libelf, libdwarf and common files from vendor/ to contrib/.
>

Just to make sure, you know that you can get this like so:
% git log --reverse --format=%h master -- contrib/elftoolchain/ | head -1
37429c2aa7e7

(note sure why using -n1 instead of head(1) will result in the latest, not
the oldest. Seems that it ignores --reverse)

Would be good if you could run a script against all contrib prefixes and
later
count the number of commits that a contrib-tree produces to see if something
weird happens.


>
> 2. Inspect the two merge parents and determine that the second
> (5265ace0e440) is the initial elftoolchain import:
>
> it 5265ace0e440a23fb522c516f4ee20f43eaed2b3
> (origin/vendor/elftoolchain/elftoolchain-r2974)
> Author: Kai Wang <kaiw@FreeBSD.org>
> Date:   Wed Jan 15 08:43:20 2014 +0000
>
>     Initial import of elftoolchain r2974.
>
>     Obtained from:  elftoolchain.org
>
>
You can test both parents whether they are reachable from
vendor/elftoolchain/dist, or look at their notes:

% git log -n1 --format=%P 37429c2aa7e7 | xargs -n1 -I@ git log -n1
--format="%h %N" @
8a7f75c8fcc5 svn path=/head/; revision=260666

5265ace0e440 svn path=/vendor/elftoolchain/dist/; revision=260684
svn path=/vendor/elftoolchain/elftoolchain-r2974/; revision=260685;
tag=vendor/elftoolchain/elftoolchain-r2974


> 3. Split the subtree, using patched git:
>
> ~/src/git/contrib/subtree/git-subtree.sh split \
>     --prefix=contrib/elftoolchain \
>     --onto=5265ace0e440a23fb522c516f4ee20f43eaed2b3
>
> The "onto" revision is the initial hash in the subtree. With the
> patched git subtree this is needed, because we don't have metadata
> about the subtree (as would be created if `git subtree add` was used
> to initially create the subtree).
>
> After some time the hash of the split tree is printed:
> 5f7e5a9dbe67c06fb6baf08f26745e537fcfe9dd
>
> At this point I can do what I like with the subtree. I could create a
> branch for it, or push it to a GitHub repo:
>
> % git push github-elftoolchain \
> 5f7e5a9dbe67c06fb6baf08f26745e537fcfe9dd:refs/heads/split-from-cgit-beta
>
> Which is now available here:
> https://github.com/emaste/elftoolchain/tree/split-from-cgit-beta


For my own understanding, all the issues around subtree splitting are
actually
not blocking the conversion in any way, right? All they do is make the
lives miserable
for contrib-software maintainers and they might delay new code drops under
contrib/ yes?

Cheers
Uli



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ9axoS-VSQm%2B8_NLYJ%2BvURmH2CDteYMYHsFbf%2BCfyDjCcCPdw>