Skip to content

Conversation

@timsutton
Copy link
Member

@timsutton timsutton commented Nov 10, 2025

Introduce --sparse-paths feature to allow sparse checkout.

The purpose for this option is to tell git-fastclone to set up a sparse-checkout instead of a regular one, still using its reference dir as the source for the clone. It doesn't allow any additional configuration of the sparse checkout besides a list of paths, at this point.

It might be that in a future version we want to improve how this option works to allow more configuration, too.

We may need #76 merged first to get CI into a healthy state.

@timsutton timsutton marked this pull request as ready for review November 18, 2025 19:18
if sparse_paths
clone_commands << mirror.to_s << clone_dest
else
clone_commands << '--reference' << mirror.to_s << url.to_s << clone_dest
Copy link
Member

@gyfelton gyfelton Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i do a full checkout then do it again with sparse checkout on the same clone_dest, what happens? for example will just one path get new updated version based on the branch, where the rest are the old version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the same clone destination already exists, then git-fastclone won't do the clone – that's how it already works. I think this is still the right way to handle things, rather than trying to deal with possibly updating an existing clone.

Example of doing two different checkouts of the same already-cached repo:

$ rm -rf bazel-sparse && be git fastclone --sparse-paths .bazelci -b master https://github.com/bazelbuild/bazel bazel-sparse; rm -rf bazel-full && be git fastclone -b master "https://github.com/bazelbuild/bazel" bazel-full

git-fastclone 1.6.0
Cloning bazel to /Users/tsutton/Development/git-fastclone/bazel-sparse
Checkout of bazel-sparse took 0.84033s

git-fastclone 1.6.0
Cloning bazel to /Users/tsutton/Development/git-fastclone/bazel-full
Checkout of bazel-full took 2.324625s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right that makes total sense, i guess another small issue is if whoever used the new feature want to know if the checkout is full or not... but that's up to them to decide anyway

# Version string for git-fastclone
module GitFastCloneVersion
VERSION = '1.5.1'
VERSION = '1.6.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have changelog.md huh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe no, I looked for the same thing


clone_commands = ['git', 'clone', verbose ? '--verbose' : '--quiet']
clone_commands << '--reference' << mirror.to_s << url.to_s << clone_dest
clone_commands.push('--no-checkout') if sparse_paths
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this line to line 259

@timsutton timsutton merged commit 65716ef into master Nov 24, 2025
11 checks passed
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.

4 participants