Skip to content

Merge gitdb and smmap into the GitPython repository#2179

Draft
Byron wants to merge 706 commits into
mainfrom
subtree-merge-deps
Draft

Merge gitdb and smmap into the GitPython repository#2179
Byron wants to merge 706 commits into
mainfrom
subtree-merge-deps

Conversation

@Byron

@Byron Byron commented Jul 21, 2026

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

Byron and others added 30 commits February 23, 2020 09:29
Tell PyPI long_description is Markdown
…pped-python-2-support

Remove setup.cfg to have a pure python wheel
Byron and others added 20 commits November 24, 2025 18:37
…ctions/actions/checkout-6

Bump actions/checkout from 5 to 6
…es/gitdb/ext/smmap-5ec977a

Bump gitdb/ext/smmap from `801bd6f` to `5ec977a`
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 thread gitdb/gitdb/test/lib.py Fixed
Comment thread gitdb/gitdb/test/test_pack.py Fixed
Comment thread gitdb/gitdb/test/test_pack.py Fixed
Comment thread gitdb/gitdb/test/test_pack.py Fixed
Comment thread gitdb/gitdb/test/test_util.py Fixed
Comment thread gitdb/gitdb/test/test_util.py Fixed
codex added 8 commits July 21, 2026 09:28
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.
The imported gitdb and smmap histories contain their own legacy formatting
and configuration. Letting GitPython's root pre-commit configuration scan
those trees produced unrelated failures and would turn the subtree merge into
a wholesale reformat.

Exclude the imported project directories at the root so existing GitPython
checks retain their previous scope; each dependency continues to own its
source style.
Running pytest below gitdb or smmap still discovers GitPython's root
configuration. Its coverage addopts target the git package, which is not the
package under test and caused the new dependency matrix jobs to fail.

Clear inherited addopts for those jobs so each imported project runs its own
test suite without GitPython-specific coverage arguments.
GitPython tests used the former submodules as clonable gitdb and smmap
repositories. Reconstructing those fixtures from a shared clone of the merged
history initially inherited GitPython's master branch and tag namespace,
causing branch and tag creation collisions.

Force the fixture branch and historical smmap tag to the imported source tips
so the reconstructed repositories have the same refs the existing tests
expect.
The imported histories exercise tree parsing with bytearray-backed buffers.
On Python 3.14 those slices remain bytearrays, while GitPython's object
constructors require immutable bytes, causing random-access tests to fail.

Normalize the parsed filename and object ID slices to bytes and cover the
bytearray input path with a regression test.
The historical gitdb and smmap test suites contain intentional legacy uses
of tempfile.mktemp. Importing them made GitPython's CodeQL workflow report
new security findings even though the code is test-only and unchanged from
the standalone projects.

Ignore only the imported test directories while continuing to analyze all
three production packages.
Creating the historical smmap tag leaves a loose, read-only Git object in the
reconstructed repository. Local clones may hardlink loose objects, and Python
3.7 on Windows cannot remove those files during temporary-directory cleanup.

Run Git garbage collection after constructing each fixture so its generated
refs and objects use normal packed repository storage before tests clone it.
Even after packing fixture objects, Git may hardlink repository metadata such
as the commit-graph during a local clone. Those read-only hardlinks made the
Unicode-path test fail only when Python 3.7 on Windows cleaned its temporary
directory.

Pass --no-hardlinks for this local fixture clone. The test remains focused on
Unicode path handling and no longer depends on platform-specific hardlink
cleanup behavior.
@Byron
Byron force-pushed the subtree-merge-deps branch from 90dda28 to f377fc7 Compare July 21, 2026 07:28
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.