git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 18:14 UTC

Re: [PATCH v2 0/3] contrib/subtree: reduce recursion during split

From
Ben Knoble <ben.knoble@gmail.com>
Date
Apr 20, 2026, 01:09 UTC
Message-ID
<14C41D80-ED09-43CF-9C7C-9862BBCEEB33@gmail.com>
In-Reply-To
<27109.13129.424068.382997@chiark.greenend.org.uk>
I didn’t see bmc on cc, so added. I think they have some thoughts on how to organize Rust code with Git. Might be relevant, even though this is contrib/
Show 82 quoted lines
> 
> Le 19 avr. 2026 à 15:56, Ian Jackson <ijackson@chiark.greenend.org.uk> a écrit :
> 
> Colin Stagner writes ("Re: [PATCH v2 0/3] contrib/subtree: reduce recursion during split"):
>> That said, a native Rust version of
>> git-subtree-split would be much faster and easier to read.
> 
> I prototyped something along the lines of the algorithm I described
> earlier.  It is very fast, as expected.
> 
> The output looks plausible when I look at it by eye, but there are
> some things that I need to look at more closely.  I should think some
> more about invariants and tests.
> 
> Overall, I think this is worth pursuing.
> 
> 
> Algorithm
> 
> I don't think it is going to be possible to precisely reproduce the
> output of the existing git-subtree split.  Indeed the existing
> git-subtree split is a bit cavalier with metadata (eg `committer` [1])
> which probably ought to be changed in any case.
> 
> Even so, it should be possible to avoid foolishly rewriting the whole
> history of the subtree, since we can stop at all the merges made by
> "git-subtree merge", which are easily detectable by the extra metadata
> keyword fields in the commit message.
> 
> 
> Packaging
> 
> Before I go much further, how do we think this would best be packaged?
> Currently my experiment is a standalone Rust package using
> dependencies ("crates" as Rust calls thme) from current Debian stable
> ("trixie"). [2]  I haven't tried it with recent deps from upstream
> crates.io.  There is not currently any entanglement with git.git; the
> repository is accessed using libgit2 via Rust's git2 wrapper (and there
> are no tests yet).
> 
> I'm tempted to continue this way and rewrite the other git-subtree
> subcommands too, since they don't look that hard.  Using git.git
> offers some packaging and testing continuity but the dependency
> situation might become annoying.
> 
> It will probably be possible to make a Rust package which will build
> with both recent upstream dependencies, and (say) Debian stable.
> Going back much more than that is going to be awkward.
> 
> I see there's already some Rust in git.git:contrib/libgit-rs but that
> looks like a poc.
> 
> Regards,
> Ian.
> 
> [1] I don't think it's justifiable to convert a commit from the
> downstream, into the subtree split version, and retain the original
> committer line.  That can violate many people's expectations.
> Here's an example from another context:
>  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1124226
> 
> That means we need to use a dummy committer in split commits, and put
> the original committer into the message.  We should name the original
> downstream commit in the commit message too.
> 
> The dummy committer needs to be a fixed string: changing it would
> cause history proliferation (maybe even leading to unnecessary merge
> conflicts).
> 
> [2] I wrote a blog post
> 
>   How to use Rust on Debian (and Ubuntu, etc.)
>   https://diziet.dreamwidth.org/18122.html
> 
> which explains why this is a good approach.
> 
> --
> 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.
> 
Previous: Ian JacksonNext: Junio C Hamano
Message 13 of 22 in “contrib/subtree: reduce function side-effects”
  1. 1/3 contrib/subtree: reduce function side-effectsColin Stagner, Mar 5, 2026
  2. 2/3 contrib/subtree: functionalize split traversalColin Stagner, Mar 5, 2026
  3. 3/3 contrib/subtree: reduce recursion during splitColin Stagner, Mar 5, 2026
  4. 0/3 contrib/subtree: reduce recursion during splitColin Stagner, Mar 5, 2026
  5. Junio C HamanoMar 13, 2026
  6. Junio C HamanoMar 13, 2026
  7. Junio C HamanoApr 15, 2026
  8. Ben KnobleApr 15, 2026
  9. Ian JacksonApr 16, 2026
  10. Junio C HamanoApr 16, 2026
  11. Colin StagnerApr 17, 2026
  12. Ian JacksonApr 19, 2026
  13. Ben KnobleApr 20, 2026
  14. Junio C HamanoApr 20, 2026
  15. Ian JacksonApr 20, 2026
  16. Colin StagnerApr 21, 2026
  17. Johannes SchindelinApr 22, 2026
  18. git-subtree rewriteIan Jackson, Apr 22, 2026
  19. Junio C HamanoJun 1, 2026
  20. Ian JacksonJun 2, 2026
  21. Colin StagnerJun 3, 2026
  22. Ian JacksonJun 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.