Subtree extensions live in src/resources/extension-subtrees.
Each is the complete git repository of a Quarto extension, e.g. the directory tree for the Julia engine looks like
src/resources/extension-subtrees/
julia-engine/
_extensions/
julia-engine/
_extension.yml
julia-engine.ts
...
The list of subtrees and their upstream repos lives in the SUBTREES table in src/command/dev-call/pull-git-subtree/cmd.ts.
Fixes to extension files must be authored upstream, never edited directly inside src/resources/extension-subtrees/<name>/. The correct workflow:
- Open a PR with the fix in the upstream repo (e.g.
quarto-ext/orange-book,PumasAI/quarto-julia-engine) - Merge the PR upstream
- From quarto-cli, run the pull command (see Pulling subtree updates)
Editing directly inside the subtree prefix is wrong: the change will be overwritten the next time the subtree is pulled, and anyone who forked the upstream extension will not benefit from it.
The command to add or update a subtree is
quarto dev-call pull-git-subtree subtree-name
Omit subtree-name to add/update all.
The code in src/command/dev-call/pull-git-subtree/cmd.ts contains a table of subtree
nameprefix(subdirectory)remoteUrlremoteBranch
If the command is successful, it will add two commits, one the squashed changes from the remote repo and one a merge commit.
The commits have subtree status information in the message and metadata, so don't change them.
The commits can't be rebased -- you'll get weird errors indicating it tried to merge changes at the root of the repo.
So you must either
- run the command when ready to merge to main, or
- remove the commits when rebasing, and run the
dev-callcommand again
Merge with Create a merge commit and keep GitHub's default message (Merge pull request #N from ... plus the PR title). Never squash-merge, and never paste the commit list into the merge message.
git subtree pull --squash finds the previous squash by searching history for the most recent git-subtree-dir: trailer. Any other commit on main carrying a copied git-subtree-dir: / git-subtree-split: trailer gets picked up as "the previous squash". The next pull then uses that full-repo commit as its base, and upstream's files silently replace any quarto-cli changes under the prefix. This happened with #14864 (0.2.2): its merge commit message embedded the squash commit's trailers, and the 0.2.3 pull (#15156) reverted an in-tree test fix without a conflict.
Check before the next pull: git log --format='%h %s' --grep='git-subtree-dir: src/resources/extension-subtrees/<name>' main | head -1 must show a Squashed '...' changes from ... commit, not a PR merge.
If a fix has already been committed directly inside the subtree prefix (wrong workflow), it needs to be re-authored upstream before resuming the normal flow. Two paths:
Faster and more predictable, especially in repos with many commits where git subtree split walks the full history.
- Clone the upstream repo locally (e.g.
git clone https://github.com/quarto-ext/orange-book.git) - Create a feature branch from upstream
main - Apply the same change at the upstream repo's path (the subtree's
_extensions/...becomes the repo root) - Commit (preserve original author and message) and push to the upstream repo
- Open a PR upstream and merge
Extracts the prefix-scoped history into a synthetic branch and pushes it. Works but is slow on large repos (the split walks every commit) and untested in this codebase.
git fetch <upstream-url> <upstream-branch>
git subtree push --prefix=src/resources/extension-subtrees/<name> \
<upstream-url> <feature-branch>
Then open a PR upstream from <feature-branch>.
Back in quarto-cli, on the branch holding the original in-tree commit:
- Remove the in-tree edit from the local commit (amend or rebase out the lines under the subtree prefix) so
pull-git-subtreedoes not conflict with itself - Run
quarto dev-call pull-git-subtree <name>to bring the upstream change in via the normal two-commit pattern - Merge the branch to
mainwithout rebasing (the subtree-pull commits cannot be rebased — see Pulling subtree updates)