Skip to content

Use git subtree (instead of git submodule) for external dependencies #266

Closed
@oli-obk

Description

@oli-obk

TL;DR

Replace all our git submodules with git subtrees. This allows us to gate CI on tools, since contributors can just fix tools in tree and tool devs synchronize the in-tree state with their repo at their leisure.

Links and Details

Git submodules shallowly add just the commit id of the remote repository to the rustc repository. This means contributors need to use git submodule update whenever they change branches. It also means, that if you make a change to rustc that breaks a submodule, you need to do a second PR just for the submodule and point the submodule at that PR. This can quickly get out of hand with quickly changing projects like rustc and its tools.

Git subtrees on the other hand basically work like a monorepo. All tool sources are in tree, and git subtree is just a synchronization tool to push changes that happened to the in-tree tool sources back to the tool repository and vice versa. Git subtree preserves commits on both sides, so changes to the tool are fully traceable in the rustc repository and rustc changes that touched the tool sources show up in the tool repository.

This creates some synchronization overhead for tool developers, but the current status quo with submodules is worse, because we have tool breakages and synchronization overhead. We don't have much experience with git subtree, so we'll have to see whether this is actually a better experience. The fact that we get rid of tool breakages without slowing down tool development in its own repo seems like a great boon even if the synchronization overhead stays the same.

Mentors or Reviewers

Metadata

Metadata

Assignees

No one assigned

    Labels

    major-changeA proposal to make a major change to rustcmajor-change-acceptedA major change proposal that was accepted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions