vcstool icon indicating copy to clipboard operation
vcstool copied to clipboard

feat: add partial clone argument in vcs import

Open Owen-Liuyuxuan opened this issue 9 months ago • 4 comments

Introduction

A partial clone is an efficient way to clone only part of the git history of a certain repository.

For example, we can clone big repositories with an extensive Git history using partial clones and save much time and networks.

git clone --filter=blob:none --no-checkout https://github.com/autowarefoundation/autoware.universe
git checkout $tag # This could be either a branch or a random tag in the history

At the time the PR was created, the partial clone could shrink the download size of autoware.universe from 1.5G (1.1G .git + 340M codes) to 500M (160M.git + 340M codes).

Implementation

In this PR, I incorporate the argument in the vcs import command for Git client. The codes are straight-forward, but it solve many of the problems we faced.

Owen-Liuyuxuan avatar Feb 05 '25 08:02 Owen-Liuyuxuan

Why not to always filter out the rest of the history on clone or fetch? The tool basically is used for an external repository checkout into a directory of the root repository. And most of the time an external repository does not require locally the history content. So the flag better to use by default and add a yaml key to force use the full history checkout.

andry81 avatar Feb 06 '25 02:02 andry81

@andry81 From our experience, we also want to set that by default, but I believe I should respect the default behavior of the code for now.

Owen-Liuyuxuan avatar Feb 06 '25 04:02 Owen-Liuyuxuan

@Owen-Liuyuxuan Last PR were merged 3 years ago, so you may want to read this: https://github.com/dirk-thomas/vcstool/issues/242

andry81 avatar Feb 06 '25 05:02 andry81

@andry81 Thank you for the information, it is also fine to put this PR as an open reference.

Owen-Liuyuxuan avatar Feb 07 '25 00:02 Owen-Liuyuxuan