Skip to content

Add sparse_checkout option to git source#9295

Open
ianks wants to merge 1 commit intoruby:masterfrom
ianks:ianks/sparse-checkout
Open

Add sparse_checkout option to git source#9295
ianks wants to merge 1 commit intoruby:masterfrom
ianks:ianks/sparse-checkout

Conversation

@ianks
Copy link
Contributor

@ianks ianks commented Feb 1, 2026

Monorepo cloning can be incredibly slow without sparse-checkout, so let's add support for a new sparse_checkout: "some/path/to/folder" option

@ianks ianks force-pushed the ianks/sparse-checkout branch from 099d1ce to 90a2722 Compare February 1, 2026 20:22
Copy link

@andheiberg andheiberg left a comment

Choose a reason for hiding this comment

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

👍 would be a big win

@ianks ianks force-pushed the ianks/sparse-checkout branch 3 times, most recently from d5563c1 to 2b476cf Compare February 2, 2026 18:53
@ianks ianks changed the title Add sparse_checkout option to git source RFC: Add sparse_checkout option to git source Feb 2, 2026
@ianks ianks force-pushed the ianks/sparse-checkout branch 3 times, most recently from 5db6d0b to 27f2eed Compare February 2, 2026 21:17
@colby-swandale colby-swandale changed the title RFC: Add sparse_checkout option to git source Add sparse_checkout option to git source Feb 3, 2026
@ianks ianks force-pushed the ianks/sparse-checkout branch from 27f2eed to fc5e8ed Compare February 3, 2026 03:51
Comment on lines +482 to +485
def partial_clone_filter_args
return [] unless @sparse_checkout && supports_partial_clone?
["--filter=blob:none"]
end

Choose a reason for hiding this comment

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

Am I correct that this is opinionated in how it combines sparse checkouts and a blobless partial clone? I might have missed it, however you might want to specifically document this, as I understand it does affect the load on the repository manager, and might be of relevance to folks.

Did you consider whether a full tree-less clone (--filter=tree:0) might be even better for the rubygems use case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback, I was unaware of the --filter=tree:0 option. Seems like a good fit from my glancing of the docs, but are there footguns?

Copy link

@chadlwilson chadlwilson Feb 20, 2026

Choose a reason for hiding this comment

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

It's git, there are always footguns right? 😅

I'm not an expert on either of these and usually end up back at https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/ to refresh my memory and think about the consequences for any subsequent operations needed on a given clone.

However, I imagine the footguns might be similar for both of them or even shallow clones.

  • issues where people may assume no need for connectivity after initial clone (and related auth issues)
  • perhaps some dependency on particular server side support on the repository manager (which people's internal repo managers may not support)
  • friendliness to semi-dumb proxies (?)

Probably not familiar enough with Rubygems to know if any of those are a realistic concern.

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

4 participants