Skip to content

Merge gitdb and smmap into the GitPython repository - #2179

Merged
Byron merged 699 commits into
mainfrom
subtree-merge-deps
Jul 25, 2026
Merged

Merge gitdb and smmap into the GitPython repository#2179
Byron merged 699 commits into
mainfrom
subtree-merge-deps

Conversation

@Byron

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-5.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Reported issue

Use this information to plan for a subtree merge, combining gitdb and ssmap repositories into GitPython.

The requested ssmap repository is interpreted as smmap, matching the named GitPython dependency and the source repository discussed in the linked issues.

Summary

  • Merge the complete smmap history at 8ce61ad5cc4016bffaf25080bc0d69b3acbe8555 into smmap/.
  • Merge the complete gitdb history at 2da3232f9d58e7761e384ac6d32f7b1ed77a74a2 into gitdb/.
  • Replace the former gitlinks with regular monorepo directories while retaining separate git, gitdb, and smmap distributions and import APIs.
  • Teach local tests, packaging, documentation, and CI to consume the in-tree dependency projects.
  • Leave repository archival, issue migration, and release-process consolidation for separate follow-up work.

Context

This implements the subtree direction discussed in GitPython issues #511, #933, and #1716, gitdb issue #116, and smmap pull request #53.

Validation

  • GitPython focused fixture, installation, historical-submodule, repository, and documentation tests
  • smmap: 9 passed
  • gitdb: 24 passed, 1 skipped
  • GitPython broader run: 689 passed, 73 skipped, 1 xfailed; remaining failures were local Python 3.14 or Git configuration/environment failures unrelated to the subtree migration
  • GitPython, gitdb, and smmap wheel and sdist builds
  • mypy for GitPython
  • dependency syntax checks and workflow YAML parsing
  • no tracked gitlinks and clean git diff --check

Byronand others added 30 commits February 17, 2020 11:15
Change force_bytes to use UTF-8 encoding by default
Tell PyPI long_description is Markdown
…pped-python-2-support
Remove setup.cfg to have a pure python wheel
chatgpt-codex-connectorBotand others added 17 commits March 9, 2026 11:33
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
…-smmap
Publish updated package metadata by bumping smmap to 5.0.3
Bumps [gitdb/ext/smmap](https://github.com/gitpython-developers/smmap) from `5ec977a` to `e4ad410`.
- [Release notes](https://github.com/gitpython-developers/smmap/releases)
- [Commits](gitpython-developers/smmap@5ec977a...e4ad410)
---
updated-dependencies:
- dependency-name: gitdb/ext/smmap
dependency-version: e4ad410
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
…es/gitdb/ext/smmap-e4ad410
Bump gitdb/ext/smmap from `5ec977a` to `e4ad410`
Python 3.14 emits a DeprecationWarning for codecs.open(), which gitdb
hits inside ReferenceDB._update_dbs_from_ref_file:
DeprecationWarning: codecs.open() is deprecated. Use open() instead.
The built-in open() has supported the encoding kwarg since Python 3.0
and the call site already passes encoding="utf-8", so the replacement
is byte-for-byte equivalent on every supported Python version.
Dropped the now-unused codecs import.
Verified the change with the existing test_ref.py suite.
Closes#128
fix: replace deprecated codecs.open with built-in open (#128)
Closes#120
DecompressMemMapReader.read(N) could return b'' mid-stream when zlib
consumed input without producing output on a single decompress call
(small N, header / dictionary frames in flight). The original
`if dcompdat and ...` guard at the recursion site skipped the
"refill to size" recursion in that case, so a caller using the
standard idiom
while chunk := stream.read(4096):
yield chunk
terminated at the first empty chunk -- before _br == _s.
The guard exists for compressed_bytes_read(), which manipulates
_br=0 and then drains the inner zip past its EOF. Recursing there
would loop forever because the inner zip is already done.
The fix uses zlib's own `eof` attribute (available on standard
zlib.Decompress objects since Python 3.6) to distinguish:
- dcompdat empty AND zip not at EOF -> still digesting, recurse
- dcompdat empty AND zip at EOF -> compressed_bytes_read
scrub or genuine EOF; do
not recurse.
`getattr(_zip, 'eof', False)` keeps the conservative behavior
when running against a custom zlib object that does not expose
the attribute.
Adds a regression test that reads with chunk_size in
{1, 4, 16, 64} from a 13 KB highly-compressible stream. With the
old guard, the chunk_size <= 16 cases stopped at byte 0; the new
test asserts they read all 13000 bytes.
The full existing test suite (24 tests) still passes, including
test_decompress_reader_special_case and test_pack which exercise
the compressed_bytes_read scrub path that the original guard
existed to protect.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fix DecompressMemMapReader.read returning b'' before EOF (#120)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v6...v7)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: '7'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
…tions/actions/checkout-7
Bump actions/checkout from 6 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v6...v7)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: '7'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
…ctions/actions/checkout-7
Bump actions/checkout from 6 to 7
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v6...v7)
---
updated-dependencies:
- dependency-name: actions/setup-python
dependency-version: '7'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
…ctions/actions/setup-python-7
Bump actions/setup-python from 6 to 7
git-subtree-dir: smmap
git-subtree-mainline: faf3c09
git-subtree-split: 8ce61ad
git-subtree-dir: gitdb
git-subtree-mainline: b3d9e00
git-subtree-split: 2da3232
Comment threadgitdb/gitdb/test/lib.py Fixed
Comment threadgitdb/gitdb/test/test_pack.py Fixed
Comment threadgitdb/gitdb/test/test_pack.py Fixed
Comment threadgitdb/gitdb/test/test_pack.py Fixed
Comment threadgitdb/gitdb/test/test_util.py Fixed
Comment threadgitdb/gitdb/test/test_util.py Fixed
@Byron
Byronforce-pushed the subtree-merge-deps branch 2 times, most recently from f377fc7 to 7e817cdCompareJuly 25, 2026 07:56
@Byron

Byron commented Jul 25, 2026

Copy link
Copy Markdown
MemberAuthor

@EliahKagan While I reviewed it hunk by hunk, the change also touches dependabot, and it's unclear if it will still pick up its work for the now 2 additional top-level packages. Let's forward-fix this if needed.

Also, I have never tried to release and would hope GitPython is unaffected, but I will find out. Also GitDB and SMMap releases are uncertain now, but if there is an issue I think it's easy to fix as well, maybe even with unified script machinery.

GitPython previously depended on gitdb and smmap through nested git
submodules. That made a complete checkout depend on extra repository state
and forced related changes to be coordinated across three repositories.
Keep both projects as independently buildable distributions under their own
top-level directories, while updating GitPython packaging, CI, documentation,
and test fixtures to consume the in-tree sources. Remove the obsolete
gitlinks and imported repository automation so a normal clone contains all
code needed to build and test the three packages.
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
@Byron
Byronforce-pushed the subtree-merge-deps branch from 7e817cd to 8a08afaCompareJuly 25, 2026 08:23
@Byron
Byron marked this pull request as ready for review July 25, 2026 08:47
CopilotAI review requested due to automatic review settings July 25, 2026 08:47
@Byron
Byron merged commit 8ecda9e into mainJul 25, 2026
50 of 51 checks passed
@Byron
Byron deleted the subtree-merge-deps branch July 25, 2026 08:47

CopilotAI 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 pull request vendors the gitdb and smmap dependency projects into the GitPython repository (monorepo layout), and updates GitPython’s tests, packaging, and CI to use the in-tree projects instead of submodules.

Changes:

  • Removes the gitdb submodule and adds in-tree gitdb/ and smmap/ projects (code, tests, docs, packaging).
  • Updates GitPython tests/fixtures to reconstruct dependency repos from the merged history for deterministic local cloning/submodule tests.
  • Adjusts packaging/typing/tooling and CI workflows to install and validate smmap and gitdb from local paths.

Reviewed changes

Copilot reviewed 107 out of 118 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
test/test_submodule.pyUpdates submodule tests to use reconstructed local dependency repo URLs.
test/test_repo.pyReworks submodule-related repo tests to use a RW fixture repo.
test/test_installation.pyInstalls smmap/gitdb and then GitPython in venv for installation validation.
test/test_fun.pyAdds coverage for tree_entries_from_data accepting bytearray.
test/test_fixture_health.pyReplaces submodule fixture checks with “no gitlinks” and trust checks.
test/test_docs.pyMakes tutorial submodule snippet run against a RW fixture repo and local URLs.
test/test_clone.pyUses no_hardlinks=True to avoid Windows cleanup issues when cloning locally.
test/lib/helper.pyAdds dependency-repo reconstruction helpers for gitdb/smmap from merged history.
smmap/tox.iniAdds smmap tox configuration for lint/test.
smmap/smmap/util.pyAdds smmap utility mapping/window primitives.
smmap/smmap/test/test_util.pyAdds smmap util tests.
smmap/smmap/test/test_tutorial.pyAdds a tutorial-style test for smmap usage.
smmap/smmap/test/test_mman.pyAdds smmap memory manager tests.
smmap/smmap/test/test_buf.pyAdds smmap buffer tests (including perf-oriented test).
smmap/smmap/test/lib.pyAdds smmap test support utilities.
smmap/smmap/test/init.pyInitializes smmap test package.
smmap/smmap/buf.pyAdds smmap buffer implementation.
smmap/smmap/init.pyAdds smmap package init and re-exports.
smmap/setup.pyAdds smmap packaging entrypoint.
smmap/setup.cfgAdds smmap flake8 configuration.
smmap/SECURITY.mdPoints smmap security reporting to GitPython’s policy.
smmap/README.mdAdds smmap README in-repo.
smmap/MANIFEST.inAdds smmap manifest.
smmap/MakefileAdds smmap convenience Makefile targets.
smmap/LICENSEAdds smmap license text.
smmap/doc/source/tutorial.rstVendors smmap tutorial documentation.
smmap/doc/source/intro.rstVendors smmap intro documentation.
smmap/doc/source/index.rstVendors smmap documentation index.
smmap/doc/source/conf.pyVendors smmap Sphinx config.
smmap/doc/source/changes.rstVendors smmap changelog.
smmap/doc/source/api.rstVendors smmap API docs.
smmap/doc/MakefileVendors smmap doc Makefile.
smmap/doc/make.batVendors smmap doc Windows build script.
smmap/doc/.gitignoreAdds smmap doc build ignores.
smmap/.gitignoreAdds smmap repo ignores.
smmap/.coveragercAdds smmap coverage configuration.
setup.pyRestricts root package discovery to git packages for GitPython distribution.
README.mdUpdates dev instructions for editable installs in the monorepo.
pyproject.tomlUpdates mypy/pyright/ruff excludes and paths for in-tree gitdb/smmap.
init-tests-after-clone.shRemoves submodule initialization step (no longer applicable).
gitdb/setup.pyAdds gitdb packaging entrypoint.
gitdb/SECURITY.mdPoints gitdb security reporting to GitPython’s policy.
gitdb/requirements.txtAdds gitdb runtime dependency constraints for smmap.
gitdb/README.rstAdds gitdb README in-repo.
gitdb/MANIFEST.inAdds gitdb manifest.
gitdb/MakefileAdds gitdb convenience Makefile targets.
gitdb/LICENSEAdds gitdb license text.
gitdb/gitdb/utils/encoding.pyAdds gitdb encoding helpers.
gitdb/gitdb/utils/init.pyInitializes gitdb utils package.
gitdb/gitdb/typ.pyAdds gitdb type constants.
gitdb/gitdb/test/test_util.pyAdds gitdb utility tests.
gitdb/gitdb/test/test_stream.pyAdds gitdb stream tests (incl. regression coverage).
gitdb/gitdb/test/test_pack.pyAdds gitdb pack tests.
gitdb/gitdb/test/test_example.pyAdds gitdb example/tutorial tests.
gitdb/gitdb/test/test_base.pyAdds gitdb base type tests.
gitdb/gitdb/test/performance/test_stream.pyVendors gitdb performance stream tests.
gitdb/gitdb/test/performance/test_pack.pyVendors gitdb performance pack tests.
gitdb/gitdb/test/performance/test_pack_streaming.pyVendors gitdb pack streaming performance tests.
gitdb/gitdb/test/performance/lib.pyAdds gitdb performance test base.
gitdb/gitdb/test/performance/init.pyInitializes gitdb performance test package.
gitdb/gitdb/test/lib.pyAdds gitdb test utilities and fixtures.
gitdb/gitdb/test/db/test_ref.pyAdds gitdb ReferenceDB tests.
gitdb/gitdb/test/db/test_pack.pyAdds gitdb PackedDB tests.
gitdb/gitdb/test/db/test_mem.pyAdds gitdb MemoryDB tests.
gitdb/gitdb/test/db/test_loose.pyAdds gitdb LooseObjectDB tests.
gitdb/gitdb/test/db/test_git.pyAdds gitdb GitDB tests.
gitdb/gitdb/test/db/lib.pyAdds shared gitdb DB test helpers.
gitdb/gitdb/test/db/init.pyInitializes gitdb DB test package.
gitdb/gitdb/test/init.pyInitializes gitdb test package.
gitdb/gitdb/exc.pyAdds gitdb exception types.
gitdb/gitdb/db/ref.pyAdds gitdb ReferenceDB implementation.
gitdb/gitdb/db/pack.pyAdds gitdb PackedDB implementation.
gitdb/gitdb/db/mem.pyAdds gitdb MemoryDB implementation.
gitdb/gitdb/db/loose.pyAdds gitdb LooseObjectDB implementation.
gitdb/gitdb/db/git.pyAdds gitdb GitDB compound implementation.
gitdb/gitdb/db/base.pyAdds gitdb DB base interfaces/compound DB logic.
gitdb/gitdb/db/init.pyRe-exports gitdb db modules.
gitdb/gitdb/const.pyAdds gitdb constants.
gitdb/gitdb/base.pyAdds gitdb core stream/info types.
gitdb/gitdb/init.pyAdds gitdb package init and re-exports.
gitdb/gitdb.proVendors gitdb project metadata file.
gitdb/doc/source/tutorial.rstVendors gitdb tutorial docs.
gitdb/doc/source/intro.rstVendors gitdb intro docs.
gitdb/doc/source/index.rstVendors gitdb docs index.
gitdb/doc/source/conf.pyVendors gitdb Sphinx config.
gitdb/doc/source/changes.rstVendors gitdb changelog.
gitdb/doc/source/api.rstVendors gitdb API docs.
gitdb/doc/source/algorithm.rstVendors gitdb algorithm discussion docs.
gitdb/doc/MakefileVendors gitdb doc Makefile.
gitdb/doc/.gitignoreAdds gitdb doc build ignores.
gitdb/AUTHORSAdds gitdb authors list.
gitdb/.gitignoreAdds gitdb repo ignores.
gitdb/.coveragercAdds gitdb coverage configuration.
git/objects/fun.pyEnsures tree parsing works for bytearray by forcing bytes(...).
doc/source/intro.rstRemoves submodule init instructions from GitPython docs.
.pre-commit-config.yamlExcludes gitdb/smmap paths from pre-commit hooks.
.gitmodulesRemoves gitdb submodule configuration.
.github/workflows/pythonpackage.ymlInstalls local smmap/gitdb in CI before running GitPython tests.
.github/workflows/dependencies.ymlAdds CI workflow to lint/test smmap and gitdb as standalone packages.
.github/workflows/cygwin-test.ymlUpdates Cygwin CI to install local smmap/gitdb and removes submodule trust paths.
.github/workflows/codeql.ymlIgnores gitdb/smmap test paths for CodeQL analysis.
.github/workflows/alpine-test.ymlUpdates Alpine CI to install local smmap/gitdb and removes submodule trust paths.
.github/dependabot.ymlRemoves submodule update configuration from dependabot.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +30 to +32
def __contains__(self, sha):
return self.has_obj

Comment on lines +58 to +59
print(sys.stderr, "PDB Streaming: Wrote pack of size %i kb in %f s (%f kb/s)" %
(total_kb, elapsed, total_kb / (elapsed or 1)), sys.stderr)
Comment threadsmmap/smmap/util.py
@@ -0,0 +1,222 @@
"""Module containing a memory memory manager which provides a sliding window on a number of memory mapped files"""
Comment threadREADME.md
The submodules must have been cloned for that to work, but that will already be the case if you have run `./init-tests-after-clone.sh`. You can use `pip list` to check which packages are installed editably and which are installed normally.
You can use `pip list` to check which packages are installed editably and which are installed normally.

To reiterate, this approach should only rarely be used. For most development it is preferable to allow the gitdb and smmap dependencices to be retrieved automatically from PyPI in their latest stable packaged versions.
Comment on lines +148 to +152
def set_ostream(self, stream):
""":raise TypeError: if the stream does not support the Sha1Writer interface"""
if stream is not None and not isinstance(stream, Sha1Writer):
raise TypeError("Output stream musst support the %s interface" % Sha1Writer.__name__)
return super().set_ostream(stream)
@Byron

Copy link
Copy Markdown
MemberAuthor

Ignoring all review comments as this is old code, which won't work worse than before without addressing them.

Sign up for freeto 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.

20 participants

@Byron@github-advanced-security@Harmon758@cool-RR@tmcclintock@hugovk@kianmeng@carlwgeorge@RandyMcMillan@zwimer@otethal@EliahKagan@DeflateAwning@clavelan@Shortfinga@blablatdinov@edgarrmondragon@DEKHTIARJonathan@sminux