{"thread":{"id":"61794","subject":"git subtree bugs (mishandled merges, recursion depth)","startedAt":"2024-07-17T16:49:19Z","lastAt":"2024-07-17T16:49:19Z","messageCount":1,"participants":["Ian Jackson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"498840","messageId":"26263.62989.829497.450160@chiark.greenend.org.uk","threadId":"61794","inReplyTo":null,"subject":"git subtree bugs (mishandled merges, recursion depth)","fromName":"Ian Jackson","fromEmail":"ijackson@chiark.greenend.org.uk","sentAt":"2024-07-17T16:49:17Z","receivedAt":"2024-07-17T16:49:19Z","isPatch":false,"sender":{"key":"ijackson@chiark.greenend.org.uk","avatar":null},"body":"I have what ought to be a fairly straightforward situation that\ngit-subtree seems to be mishandling.\n\nSteps to reproduce:\n\n git clone https://gitlab.torproject.org/tpo/core/arti.git\n cd arti\n git checkout 01d02118cdda30636e606fc1a89b3e04f28b8ad1\n git subtree split -P maint/rust-maint-common\n\nExpected behaviour:\n\n git subtree (hopefully fairly rapidly) prints a the commitid of the\n tip of a branch suitable for merging back to the upstream repo, which\n is at https://gitlab.torproject.org/tpo/core//rust-maint-common\n\n The resulting history ought to have a few dozen commits,\n most of which are the upstream history of the subtree.\n\nActual behaviour (git 2.45.2, Debian amd64 1:2.45.2-1 .deb):\n\n $ git subtree split -P maint/rust-maint-common\n /usr/lib/git-core/git-subtree: 318: Maximum function recursion depth (1000) reached\n $\n\nActual behaviour (git 2.20.1, Debian ancient 1:2.20.1-2+deb10u9):\n\n Takes a very long time.  Everntually produces an output commit\n which has most of arti.git#main in its history.\n\nNotes about the source repository:\n\n The state of arti.git:maint/rust-maint-common is the result of the\n following:\n   (i) create a new rust-maint-common.git, and add and edit files\n     (many of these changes came via gitlab MRs, there are merges)\n   (ii) in arti.git, `git subtree add`, and make further changes,\n     to files both within and without the subtree\n   (iii) Make a gitlab MR from (ii) and merge it into arti.git#main.\n     (resulting in a fairly merge-rich history)\n     https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2267\n\nA workaround:\n\n If I check out main^2 (01d02118cdda30636e606fc1a89b3e04f28b8ad1^2)\n and run git-subtree split using the ancient version of git, it still\n takes ages, but the output is correct.  So the old version of git has\n a bug meaning it can produce higly excessive output, when merges are\n present.\n\n This workaround is only available because right now the history of\n the subtree's files, within arti.git, is fairly simple.\n\n With the new version of git, I get the \"recursion depth\" error,\n regardless.\n\nThanks for your attention.\n\nIan.\n\n-- \nIan Jackson <ijackson@chiark.greenend.org.uk>   These opinions are my own.  \n\nPronouns: they/he.  If I emailed you from @fyvzl.net or @evade.org.uk,\nthat is a private address which bypasses my fierce spamfilter.\n"}]}