| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fc4399d commit f38240f
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,6 +45,14 @@ fallbacks. | |||
| 45 | 45 | ||
| 46 | 46 | ## Index and object metadata lifecycle | |
| 47 | 47 | ||
| 48 | + `git.GitDB` and `git.db.GitDB` remain compatibility aliases for | ||
| 49 | + `GitCmdObjectDB`, so legacy `Repo(..., odbt=GitDB)` selectors use the same | ||
| 50 | + managed backend. Aider 0.86.2 uses that selector for every repository open. | ||
| 51 | + This does not restore gitdb's Python object database or its specialized APIs. | ||
| 52 | + Object queries continue through `object_data()` and the supported | ||
| 53 | + `Repository.try_find_header()`/`find_object()` APIs, with the existing large-object | ||
| 54 | + and diagnostic CLI fallbacks. Storage uses the existing `hash_object` dispatch. | ||
| 55 | + | ||
| 48 | 56 | `IndexFile` queries immutable entry records; it does not retain a parsed index. | |
| 49 | 57 | The compatibility `entries` property projects those queries into a read-only | |
| 50 | 58 | snapshot keyed by path and stage, preserving readers in dlt and Renku. It uses | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,9 +54,11 @@ API changes | |||
| 54 | 54 | * ``GitCmdObjectDB`` no longer inherits ``LooseObjectDB``. Its object reads, | |
| 55 | 55 | writes, existence checks, and enumeration use Git, including packed objects. | |
| 56 | 56 | Precompressed input streams and custom object-output writers are unsupported. | |
| 57 | - ``GitDB`` exports and backend selection are removed. ``odbt`` accepts only | ||
| 58 | - ``GitCmdObjectDB`` and its subclasses, rejecting unsupported types before | ||
| 59 | - initialization or cloning. Remove ``odbt=GitDB`` or select ``GitCmdObjectDB``. | ||
| 57 | + ``GitDB`` remains exported as a compatibility alias for ``GitCmdObjectDB``; | ||
| 58 | + ``odbt=GitDB`` selects the same managed Git/Gix backend. It no longer selects | ||
| 59 | + gitdb's Python storage implementation or supports that implementation's | ||
| 60 | + specialized interfaces. ``odbt`` accepts ``GitCmdObjectDB`` and its subclasses, | ||
| 61 | + rejecting unsupported types before initialization or cloning. | ||
| 60 | 62 | ``gitdb`` remains a dependency for shared types and utilities. | |
| 61 | 63 | * ``Repo.object_format`` and ``Repo.ref_format`` report Git's storage formats. | |
| 62 | 64 | ``Repo.alternates`` is read-only and reports effective absolute alternate | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,7 @@ | |||
| 29 | 29 | "GitCommandError", | |
| 30 | 30 | "GitCommandNotFound", | |
| 31 | 31 | "GitConfigParser", | |
| 32 | + "GitDB", | ||
| 32 | 33 | "GitError", | |
| 33 | 34 | "HEAD", | |
| 34 | 35 | "Head", | |
@@ -146,7 +147,7 @@ | |||
| 146 | 147 | DiffIndex, | |
| 147 | 148 | Diffable, | |
| 148 | 149 | ) | |
| 149 | - from git.db import GitCmdObjectDB # @NoMove | ||
| 150 | + from git.db import GitCmdObjectDB, GitDB # @NoMove | ||
| 150 | 151 | from git.cmd import Git # @NoMove | |
| 151 | 152 | from git.repo import Repo # @NoMove | |
| 152 | 153 | from git.remote import FetchInfo, PushInfo, Remote, RemoteProgress # @NoMove | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | """Git's object database, accessed exclusively through the Git command.""" | |
| 5 | 5 | ||
| 6 | - __all__ = ["GitCmdObjectDB"] | ||
| 6 | + __all__ = ["GitCmdObjectDB", "GitDB"] | ||
| 7 | 7 | ||
| 8 | 8 | import tempfile | |
| 9 | 9 | from typing import Iterator, TYPE_CHECKING | |
@@ -107,3 +107,8 @@ def partial_to_complete_sha_hex(self, partial_hexsha: str) -> bytes: | |||
| 107 | 107 | return hex_to_bin(hexsha) | |
| 108 | 108 | except (GitCommandError, ValueError) as exc: | |
| 109 | 109 | raise BadObject(partial_hexsha) from exc | |
| 110 | + | ||
| 111 | + | ||
| 112 | + # Preserve the public object-backend selector used by downstream applications. | ||
| 113 | + # Storage remains owned by Git/Gix; this does not restore gitdb's Python backend. | ||
| 114 | + GitDB = GitCmdObjectDB | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,9 +4,27 @@ | |||
| 4 | 4 | ||
| 5 | 5 | import pytest | |
| 6 | 6 | ||
| 7 | + import git | ||
| 8 | + import git.db | ||
| 9 | + | ||
| 7 | 10 | from test.lib.fixtures import fixture_repo | |
| 8 | 11 | ||
| 9 | 12 | ||
| 13 | + @pytest.mark.parametrize("object_format", ["sha1", "sha256"]) | ||
| 14 | + @pytest.mark.parametrize("ref_format", ["files", "reftable"]) | ||
| 15 | + def test_legacy_gitdb_selector_uses_the_managed_object_backend(object_format, ref_format): | ||
| 16 | + assert git.GitDB is git.db.GitDB is git.GitCmdObjectDB | ||
| 17 | + with fixture_repo("downstream-index.sh", object_format, ref_format) as fixture: | ||
| 18 | + with git.Repo(fixture.working_tree_dir, odbt=git.GitDB) as repo: | ||
| 19 | + assert isinstance(repo.odb, git.GitCmdObjectDB) | ||
| 20 | + blob = repo.head.commit.tree["tracked"] | ||
| 21 | + assert repo.odb.has_object(blob.binsha) | ||
| 22 | + info = repo.odb.info(blob.binsha) | ||
| 23 | + assert info.binsha == blob.binsha | ||
| 24 | + assert info.type == b"blob" | ||
| 25 | + assert repo.odb.stream(blob.binsha).read() == blob.data_stream.read() | ||
| 26 | + | ||
| 27 | + | ||
| 10 | 28 | @pytest.mark.parametrize("object_format", ["sha1", "sha256"]) | |
| 11 | 29 | @pytest.mark.parametrize("ref_format", ["files", "reftable"]) | |
| 12 | 30 | def test_index_entries_readers_retain_pending_and_published_snapshots(object_format, ref_format): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments