Skip to content

SHA256: Support submodules in SHA256 repositories#1979

Merged
pjbgf merged 3 commits into
go-git:mainfrom
pjbgf:sha256-basic
Apr 29, 2026
Merged

SHA256: Support submodules in SHA256 repositories#1979
pjbgf merged 3 commits into
go-git:mainfrom
pjbgf:sha256-basic

Conversation

@pjbgf

@pjbgf pjbgf commented Apr 10, 2026

Copy link
Copy Markdown
Member

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.

Copilot AI review requested due to automatic review settings April 10, 2026 12:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread backend/http/http_test.go Outdated
Comment thread repository_test.go Outdated
Comment thread submodule_test.go Outdated
Comment thread x/plumbing/worktree/worktree_test.go
@pjbgf pjbgf mentioned this pull request Apr 16, 2026
15 tasks
@pjbgf pjbgf force-pushed the sha256-basic branch 3 times, most recently from e54969b to 7e42d7d Compare April 25, 2026 21:42
@pjbgf pjbgf changed the title SHA256: Expand fixture-based tests and add submodule support SHA256: Support submodules in SHA256 repositories Apr 25, 2026
Comment on lines 33 to 35
s.Storer = memory.NewStorage()
s.EmptyStorer = filesystem.NewStorage(emptyFS, nil)
s.NonExistentStorer = memory.NewStorage()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

As per off-line chat, that was to fix a bug in those tests. Let's handle that separately on its own PR.

pjbgf added 3 commits April 29, 2026 22:30
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>
@pjbgf pjbgf merged commit 4fb9547 into go-git:main Apr 29, 2026
15 of 16 checks passed
@pjbgf pjbgf deleted the sha256-basic branch April 29, 2026 21:38
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