Skip to content

Instantly share code, notes, and snippets.

@maxmoehl
Created May 2, 2025 05:52
Show Gist options
  • Save maxmoehl/326b802f4f3c0a369e62d5b6b6818c4d to your computer and use it in GitHub Desktop.
Save maxmoehl/326b802f4f3c0a369e62d5b6b6818c4d to your computer and use it in GitHub Desktop.
Inlining a BOSH Release Submodule

Inlining a BOSH Release Submodule

You need the following info which can be found in the .gitmodules file of the release:

  • Path to the submodule.
  • Tracking branch (git config --file .gitmodules submodule."${Path}".branch).
  • URL of the repository (git config --file .gitmodules submodule."${Path}".url).

First, remove the submodule:

git rm "${Path}"
git commit --message "remove ${Path} submodule"

Second, add the code via git-subtree(1):

git subtree add --prefix "${Path}" "${Url}" "${Branch}"

This will automatically create a merge commit for the two histories and bring in all the commits from the other repository.

Next, you should clean up the additional files which are probably not needed anymore as they are also present in the release:

  • .github/
  • LICENSE
  • NOTICE
  • CODEOWNERS
  • README.md
  • ISSUE_TEMPLATE.md
  • and other files you might find

The docs/ directory of repository should be merged into the docs/ directory of the release.

You should make sure that the repository is not referenced elsewhere as a submodule which can be done via this link (replace ${Name} with the name of the repository, e.g. routing-info):

https://github.com/search?q=%22https%3A%2F%2Fgithub.com%2Fcloudfoundry%2F${Name}%22+path%3A.gitmodules&type=code

And also that the repository is not directly imported by someone as those imports will no longer work (again, replace ${Name}):

https://pkg.go.dev/code.cloudfoundry.org/${Name}?tab=importedby

Now you can push your branch and open a PR, make sure to include the two links so that the reviewer can double-check them.

Back in the original repository which was just added as a subtree, add this deprecation notice as a last change before archiving:

> [!CAUTION]
> This repository has been in-lined (using git-subtree) into routing-release. Please make any
> future contributions directly to routing-release.

And ask a repository admin to block further changes to this repository.

In the community repository, remove the repository from the technical assets of the WG and set archived: true in orgs/orgs.yml.

In the CI repository, remove the submodule from the submodule sync at *-release/linters/sync-submodule-config.bash and remove the README which is currently synced via CI from *-release/readme/.

You can find examples for all of these activities in routing-release#459. I recommend you look at the PRs of batch 3 as by that point I knew what I was doing and all the changes should be correct in the first PR to each repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment