Skip to content

Add regression test: blob content readable next to a submodule - #243

Merged
lyrixx merged 1 commit into
mainfrom
worktree-issue-12-submodule-blob
Sep 7, 2026
Merged

Add regression test: blob content readable next to a submodule#243
lyrixx merged 1 commit into
mainfrom
worktree-issue-12-submodule-blob

Conversation

@lyrixx

@lyrixx lyrixx commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Issue #12 reported that a submodule entry in a tree made it impossible to read the content of sibling blobs, because the tree parser's regex (/(blob|tree)/A) didn't recognize the commit entry type used for submodules.

This has already been fixed in the current codebase:

  • TreeParser accepts blob, tree and commit entry types.
  • Tree::initialize() builds a CommitReference for submodule entries instead of failing.
  • Blob::getContent() reads content directly via cat-file -p <hash>, independent of tree parsing.

I verified against the test fixture (which already contains a barbaz submodule alongside regular files) that reading blob content next to a submodule works correctly. This PR only adds a regression test to lock in that behavior, since there wasn't one covering this exact scenario.

Test plan

  • Added testGetContentSiblingToSubmodule in BlobTest.php
  • Full test suite passes (227 tests)

Closes #12

Reading a blob's content in a tree that also contains a submodule used
to fail (issue #12) because the tree parser did not recognize the
"commit" entry type. This has since been fixed, but there was no test
covering the scenario, so add one to prevent a regression.
@lyrixx
lyrixx merged commit 1da6ab3 into main Sep 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

A submodule in a directory causes the entire directory to not be "blob get contents" able.

1 participant