Description of the feature request
To save time while cloning a bigger git repository, I’d like the Git Clone Repository action to support blobless and/or treeless clones. This boils down to running git clone --filter=blob:none <url>
or git clone --filter=tree:0 <url>
. This is different from creating a shallow clone, which is supported. There’s a great writeup on the differences between these options on the GitHub blog: Get up to speed with partial clone and shallow clone.
Use case / for what or how I would use it
For some of our CI workflows, we need the full history of commits and tags etc., even though we only check out one or two branches in the process, or merge a branch into another. Think of creating a changelog from commit messages and tags, for example. A shallow clone wouldn’t cut it in this case because it doesn’t fetch the history.
Blobless and treeless clones are almost as fast as shallow clones, but they bring with them the full commit history, and also all trees in the case of the blobless clones. They also automatically download missing data (file contents, or file history in the case of a treeless clone) from the remote should it be necessary for something to function.
Here are some numbers for a repo with a longer history that I’ve tested this with:
Time to clone | Disk space used | |
---|---|---|
full clone | 57s | 681 MB |
blobless clone | 7s | 38 MB |
treeless clone | 8s | 33 MB |
shallow clone | 4s | 30 MB |
The sweet spot for us would be the blobless clone. It would download everything we need in a fraction of the time of fetching everything, and without laying any restrictions on further use of the repo.