-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to vendor scripts in pathogen repos? #3
Comments
What's the use case of changing the branch of a subtree? Always pulling from |
I briefly explored git-subrepo as a potential alternative to Some things that are nice compared to
I tested this out by creating a subrepo for nextstrain/ingest in my personal testing repo. |
One use case is when a script needs modifications and you want to push them, however I think my subsequently suggested way to do this outside of git-subrepo looks good too. I'll give it a try. It shares the very nice feature that a user of the pipeline (and oftentimes the developer) doesn't need to know anything about it! |
I tried this myself for the same
Notes:
|
Example PRs using git-subrepo: |
Thoughts on
|
From #3 (comment):
I just realized that these commit messages aren't visible when looking at the log of a particular file, but they are in the blame. Examples: Having the blame might be useful, at the cost of a more verbose git history. I think the only way to truly understand the value here is to use it in practice for a bit! |
Oh, just figured out it's possible to see the commit history of a subrepo (without all of the git history pollution):
You can also see commit history of a single file if you provide the filepath from the ingest repo:
|
Revisiting our previous decisions in #3 after @victorlin did more testing with the monkeypox repo with `git subtree` in nextstrain/mpox#162 and `git subrepo` in nextstrain/mpox#164.
I'm looking back at the Slack conversation and it seems like we were on the fence about Since we've adopted Things to consider:
|
Closing with status quo of |
This issue was originally written as an overview of
git subtree
, but later repurposed into a discussion of how to vendor scripts, specifically choosing betweengit subtree
andgit subrepo
. In the end, we settled ongit subrepo
noting that this is a small implementation detail that can vary by pathogen repo, and be changed in the future.Original issue
This is a summary of how I used
git subtree
as part of #2. Note that different pipelines can choose different methods of vendoring scripts from this repo, butgit subtree
is particularly nice as it requires no knowledge of its existence from a user of the pipeline.Helpful reading: Git Subtree basics
The script was added to this repo (nextstrain/ingest) from within nextstrain/hepatitisB using ingest as a subtree. Specifically, from the hepB repo:
It was tested in monkeypox by pulling in (this branch of) the ingest repo as a subtree, and updating the transform rule accordingly.
Reflections
This approach is pretty straightforward but changing the branch of a subtree seems to pollute the git history a bit. An alternative approach would be to simply have a subtree of ingest at the
main
branch, push any changes to the subtree up to a branch of the subtree, merge that branch via GitHub (with code review etc), then pull down the changes once they're on themain
branch (of the subtree repo).Given a script with differences in multiple repos, the most straightforward may be to simply to create a to-be-vendored version of a script locally, copy it into each repo to test, and when you are satisfied create a PR in this
ingest
repo without using subtrees at all. Once it's inmain
, it is straightforward to pull it into each pathogen repo usinggit subtree pull ...
.Comments / improvements welcome. At the very least this may give others a quick start guide!
The text was updated successfully, but these errors were encountered: