docs: correct the shallow clone claim for commit plus branch - #2147
Merged
matheuscscp merged 1 commit intoSep 1, 2026
Merged
Conversation
Combining .spec.ref.commit with .spec.ref.branch does not shallow clone. cloneCommit in fluxcd/pkg/git/gogit sets no Depth at all, unlike the branch, tag and semver paths, so a branch only narrows the clone to a single branch and the full history of that branch is still fetched. The wording predates the go-git and libgit2 split and has been inaccurate since. Signed-off-by: SaiPisey2 <piseysai0202@gmail.com>
Member
|
Successfully created backport PR for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2146 — the documentation half only.
The v1 GitRepository docs say that combining
.spec.ref.commitwith.spec.ref.branchperforms a shallow clone of the branch. It does not.In
fluxcd/pkg/git/gogit,cloneBranch,cloneTagandcloneSemVerall setDepthfromopts.ShallowClone.cloneCommithas noDepthfield in itsCloneOptionsat all, andClient.clonedispatches onCommitbefore any other ref field, so a commit-pinned GitRepository always takes that path. Setting a branch alongside it only setsSingleBranchandReferenceName, so the clone is narrowed to one branch but still fetches that branch in full.The wording appears to predate the
gitImplementation: go-git | libgit2split, where it was carried over from the v1beta2 field comment.This only corrects the documentation. The bounded-depth mechanism and the
LastObservedCommitfast path also raised in #2146 are behaviour changes influxcd/pkgand are left for maintainers to weigh in on first.