Skip to content

Conversation

@KristofferC
Copy link
Member

@KristofferC KristofferC commented Nov 2, 2025

why use many commits when few do trick?

I want to use this in Pkg, e.g. when cloning a registry or a package in pkg add.

Written by Claude Code 🤖

why use many commits when few do trick?
@KristofferC KristofferC requested a review from Keno November 2, 2025 20:02
@KristofferC KristofferC added the libgit2 The libgit2 library or the LibGit2 stdlib module label Nov 2, 2025
@DilumAluthge
Copy link
Member

It's been mentioned in the past (I can dig up the links) that GitHub doesn't like people doing shallow clones, and has asked others (Homebrew) to stop doing shallow clones. IIRC, the initial shallow clone isn't the problem; the problem is that subsequent fetches are very expensive on GitHub's servers.

That was in the context of Homebrew's usage of shallow clones. I don't know if our usage pattern is the same or different, so I don't know if the same admonishment applies to us here.

@KristofferC
Copy link
Member Author

KristofferC commented Nov 2, 2025

Our pattern is way different. And that's a discussion more for Pkg, the option is nice to have available here anyway.

* `depth::Integer=0`: create a shallow clone with a history truncated to the
specified number of commits. `0` indicates a full clone (the default).
Use `Consts.FETCH_DEPTH_UNSHALLOW` to fetch all missing data from a shallow clone.
Note: shallow clones are only supported for network protocols (http, https, git, ssh), not for local filesystem paths.
Copy link
Member

Choose a reason for hiding this comment

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

Add a link to the upstream bug for this as a reference so people in the future can re-check whether this is still true? libgit2/libgit2#6634

@KristofferC KristofferC merged commit d484e19 into master Nov 3, 2025
6 of 8 checks passed
@KristofferC KristofferC deleted the kc/libgit2-depth branch November 3, 2025 14:56
KristofferC added a commit that referenced this pull request Nov 5, 2025
@KristofferC KristofferC mentioned this pull request Nov 5, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.13 libgit2 The libgit2 library or the LibGit2 stdlib module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants