threads / discuss / 61794

git subtree bugs (mishandled merges, recursion depth)

Subject: git subtree bugs (mishandled merges, recursion depth)

## tl;dr

One message between Jul 17, 2024 and Jul 17, 2024.

replies: 0people: 1as markdown or json

Ian Jackson· Jul 17, 2024, 16:49 UTC · lore

I have what ought to be a fairly straightforward situation that git-subtree seems to be mishandling.

Steps to reproduce:
 git clone https://gitlab.torproject.org/tpo/core/arti.git
 cd arti
 git checkout 01d02118cdda30636e606fc1a89b3e04f28b8ad1
 git subtree split -P maint/rust-maint-common
Expected behaviour:
 git subtree (hopefully fairly rapidly) prints a the commitid of the
 tip of a branch suitable for merging back to the upstream repo, which
 is at https://gitlab.torproject.org/tpo/core//rust-maint-common
 The resulting history ought to have a few dozen commits,
 most of which are the upstream history of the subtree.
Actual behaviour (git 2.45.2, Debian amd64 1:2.45.2-1 .deb):
 $ git subtree split -P maint/rust-maint-common
 /usr/lib/git-core/git-subtree: 318: Maximum function recursion depth (1000) reached
 $
Actual behaviour (git 2.20.1, Debian ancient 1:2.20.1-2+deb10u9):
 Takes a very long time.  Everntually produces an output commit
 which has most of arti.git#main in its history.
Notes about the source repository:
 The state of arti.git:maint/rust-maint-common is the result of the
 following:
   (i) create a new rust-maint-common.git, and add and edit files
     (many of these changes came via gitlab MRs, there are merges)
   (ii) in arti.git, `git subtree add`, and make further changes,
     to files both within and without the subtree
   (iii) Make a gitlab MR from (ii) and merge it into arti.git#main.
     (resulting in a fairly merge-rich history)
     https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2267
A workaround:
 If I check out main^2 (01d02118cdda30636e606fc1a89b3e04f28b8ad1^2)
 and run git-subtree split using the ancient version of git, it still
 takes ages, but the output is correct.  So the old version of git has
 a bug meaning it can produce higly excessive output, when merges are
 present.
 This workaround is only available because right now the history of
 the subtree's files, within arti.git, is fairly simple.
 With the new version of git, I get the "recursion depth" error,
 regardless.
Thanks for your attention.
Ian.
-- 
Ian Jackson <ijackson@chiark.greenend.org.uk>   These opinions are my own.  

Pronouns: they/he.  If I emailed you from @fyvzl.net or @evade.org.uk,
that is a private address which bypasses my fierce spamfilter.

← back to recent threads