SHA256: Support submodules in SHA256 repositories#1979
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends SHA-256 repository support by ensuring submodule repositories are opened/initialized with the correct object format and by expanding fixture-driven tests to cover SHA-256 variants across cloning, submodules, and pack/index parsing.
Changes:
- Propagate object format into filesystem submodule storage and keep it in sync when setting object format.
- Refactor/expand tests to use fixture metadata (
ByObjectFormat, fixture-provided pack entries/scanner entries) for both SHA-1 and SHA-256. - Add new submodule configuration tests to validate config isolation and persistence behavior for submodule repos.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| x/plumbing/worktree/worktree_test.go | Adjusts fuzz test behavior for worktree add. |
| submodule_test.go | Converts submodule suite to fixture-driven parallel tests; adds SHA-256 submodule name handling. |
| submodule_config_test.go | Adds tests for submodule repo config isolation/persistence and module config writes; introduces shared helpers. |
| storage/filesystem/storage.go | Plumbs object format into ModuleStorage and updates it in SetObjectFormat. |
| storage/filesystem/module.go | Creates submodule storers via NewStorageWithOptions carrying the selected object format. |
| storage/filesystem/storage_test.go | Updates fixtures selection to use .ByObjectFormat(...) and extends object-format-set tests accordingly. |
| repository_test.go | Updates clone/fetch/submodule tests to use .ByObjectFormat(...) fixtures and SHA-256-aware expectations. |
| plumbing/format/packfile/scanner_test.go | Switches scanner tests to fixture-registered expected scanner entries and pack hashes. |
| plumbing/format/packfile/parser_test.go | Uses fixture entries for parser assertions; adds storage-mode coverage for SHA-1 fixtures. |
| plumbing/format/packfile/packfile_test.go | Generalizes packfile tests/benchmarks to SHA-1 and SHA-256 via fixture entries and object ID sizing. |
| plumbing/format/index/decoder_test.go | Updates SHA-256 index fixture selection via .ByObjectFormat("sha256"). |
| internal/fixtureutil/entries.go | Adds helpers to map fixture entry/scanner-entry data into plumbing types for tests. |
| backend/http/http_test.go | Updates object-format capability tests to use .ByObjectFormat(...) fixtures. |
| go.mod / go.sum | Bumps go-git-fixtures dependency to a newer revision with expanded SHA-256 metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e54969b to
7e42d7d
Compare
Comment on lines
33
to
35
| s.Storer = memory.NewStorage() | ||
| s.EmptyStorer = filesystem.NewStorage(emptyFS, nil) | ||
| s.NonExistentStorer = memory.NewStorage() |
Member
There was a problem hiding this comment.
Is this intentional? Do we want different storer types?
Comment on lines
-77
to
79
| s.Storer = env.Storer | ||
| s.Storer = memory.NewStorage() | ||
| s.EmptyStorer = env.EmptyStorer | ||
| s.NonExistentStorer = env.NonExistentStorer |
Member
Author
There was a problem hiding this comment.
As per off-line chat, that was to fix a bug in those tests. Let's handle that separately on its own PR.
Signed-off-by: Paulo Gomes <paulo@entire.io>
…ures Refactor packfile, scanner, and parser tests to derive expected data from go-git-fixtures rather than hardcoding hashes, offsets, headers, and CRCs inline. All tests now loop over fixtures tagged with "packfile-entries" or "scanner-entries", covering SHA1 (ofs-delta, ref-delta) and SHA256 formats automatically. Add internal/fixtureutil package to bridge go-git-fixtures plain types to go-git plumbing types (Entries, ScannerEntries). Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Paulo Gomes <paulo@entire.io>
Convert submodule tests from suite-based to standalone functions using fixtures.Run, so they exercise both object formats. Remove hardcoded SHA-1 hashes and derive expected values from the index instead. Propagate objectFormat in SetObjectFormat to ConfigStorage and ModuleStorage so submodule repositories opened via the filesystem storer pick up the correct format without a config overlay. Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Paulo Gomes <paulo@entire.io>
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.
This PR now enables cloning of SHA-256 repositories with submodules.
Several other tests were updated to align with latest changes from go-git-fixtures, which are now
ObjectFormat-aware.Relates to #706.