Skip to content

feat(pkg): install from branch and subdirectory#126

Draft
xkevio wants to merge 2 commits into
typst-community:mainfrom
xkevio:sparse_checkout
Draft

feat(pkg): install from branch and subdirectory#126
xkevio wants to merge 2 commits into
typst-community:mainfrom
xkevio:sparse_checkout

Conversation

@xkevio

@xkevio xkevio commented May 31, 2026

Copy link
Copy Markdown

Allows to install a local package from a branch and/or a sub-directory of a git repository.

Adds two new flags to the pkg install sub-command:

  • --branch/-b to specify the branch to clone from
  • --subdir/-s to specify a relative path to a sub-directory inside the repository

Slightly modifies the clone_git function by adding an optional branch parameter, such that the command resolves to git clone -b <branch> --single-branch <URL> if a branch is specified. The --single-branch ensures that no other branches are fetched.

For --subdir, I used a combination of git clone filter and git sparse-checkout as described in this SO thread.

I have not done extensive testing yet but it has worked in my preliminary testing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant