feat: shallow clone git repository sources#3542
Conversation
|
@wale is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
|
Thanks, @wale. repository: string | { url, branch } | { url, tag }Also it would be awesome if we can compare performance of old logic and new one |
I had initially figured it was out of scope, but that is a good idea, the change would make it much more cohesive.
That's a good idea, although wouldn't it be more sensible to keep both the previous logic (i.e. downloading a tarball from provider) and this PR? In case one doesn't work, the other might make more sense to use; preferably as Github and Bitbucket specific sources. |
|
I'd keep only one solution if it's generic enough, So if new solution works for Github and Bitbucket lets use it. But we can provide a compatibility solution and deprecate old usage before removing them all. As an alternative, I was thinking about using giget package to download repositories. We need to check about the coverage and performance of giget and |
That's true, I'll keep my generic solution, and hide the previous logic behind a boolean (
Personally I think |
What I like is to make it work with current config. And deprecate it in favor of new syntax if needed. So users don't need to change their config on upgrade. If any change is necessary we force it in v4 |
Co-authored-by: Farnabaz <farnabaz@gmail.com>
Co-authored-by: Farnabaz <farnabaz@gmail.com>
|
Could we get this merged? Been waiting for this feature quiet a while now :) |
🔗 Linked issue
Reopens and closes #3338, continues #3531
❓ Type of change
📚 Description
Creates the option of shallow cloning (
--depth=1 --single-branch) a Git repository, by enabling a boolean optioncloneRepository.This change also adds support for cloning repositories with Git refs (tags and branches only), with another option in the source definition; alongside support for usernames with authentication tokens, as an attempt to support Forgejo-based (and other odd) providers.
The change was required as I use a non-Github/BitBucket repository for external Markdown files, and the current solution of submodules +
git-sparse-checkoutwas no longer tenable.The Git source also stores
.content.cache.jsondifferently to Github/Bitbucket sources, like so:{ "url": "<repo-url>", "hash": "<git-commit-hash>", "createdAt": "2025-09-16T08:07:28.525Z", "updatedAt": "2025-09-16T08:07:28.525Z" }where the Git commit hash is referencing
git ls-remote.Uses
isomorphic-gitto avoid shelling out to thegitCLI. Needs testing onbunenvironments.📝 Checklist