Skip to content

gitindex: set filter for cat-file#1026

Merged
keegancsmith merged 1 commit intomainfrom
k/cat-file-filter
Mar 27, 2026
Merged

gitindex: set filter for cat-file#1026
keegancsmith merged 1 commit intomainfrom
k/cat-file-filter

Conversation

@keegancsmith
Copy link
Member

At Sourcegraph we do a sparse clone which excludes files based on max file size. However, cat-file will hydrate in missing objects. So we pass in the same filter to avoid hydrating in those files while running zoekt-git-index.

See #1021

At Sourcegraph we do a sparse clone which excludes files based on max
file size. However, cat-file will hydrate in missing objects. So we pass
in the same filter to avoid hydrating in those files.
@keegancsmith
Copy link
Member Author

cc @clemlesne

@keegancsmith
Copy link
Member Author

Also I see why in the original version of #1021 it treated missing as skipped large files. That is what we did in go-git since that matched up the behaviour we expect when sourcegraph shallow clones a repo. Good to keep the "missing" status since that is more accurate.

@clemlesne
Copy link
Contributor

clemlesne commented Mar 26, 2026

Indeed that use case was completely missing from the integration tests. Would be useful to add it (like you use it internally?) to avoid future issues!

@keegancsmith
Copy link
Member Author

This PR adds a test which asserts the behaviour around missing vs excluded in git cat-file when you do a sparse clone.

@keegancsmith keegancsmith merged commit ddbde8b into main Mar 27, 2026
8 checks passed
@keegancsmith keegancsmith deleted the k/cat-file-filter branch March 27, 2026 11:14
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.

3 participants