Skip to content

Commit 00f05f7

Browse files
codexByron
authored andcommitted
docs: align documentation with released behavior
The documentation described temporary development regressions as restored public behavior, including a `TreeModifier` deprecation that never shipped. Audit current guidance and the changelog against `3.2.1` and the relevant historical release tags so dependants see the net changes from releases. Describe tree editing, configuration assignment, revision paths, literal paths and compatibility imports directly. Clarify that `GitDB` selects the managed backend, and scope the version lookup improvement to source checkouts. Remove the historical tree-removal entry: its announcement shipped in `1.0.2`, but the API was present in both `1.0.1` and `1.0.2`. Keep genuine released deprecations and fixes. Identify the Gix integration as unreleased and its measurements as development validation. Remove internal restoration and commit-rewrite narration while preserving compatibility bugs, reproduction evidence and measurement caveats. The strict Sphinx HTML build, Ruff lint/format checks and `git diff --check` pass. Python AST comparison confirms that source edits affect only docstrings and comments; runtime tests were not rerun for this documentation-only change.
1 parent 265a951 commit 00f05f7

9 files changed

Lines changed: 100 additions & 109 deletions

File tree

‎doc/gix-backend.md‎

Lines changed: 31 additions & 32 deletions
Large diffs are not rendered by default.

‎doc/source/changes.rst‎

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -51,40 +51,28 @@ Git executable and safety
5151
API changes
5252
-----------
5353

54-
* Packed tag names containing non-UTF-8 bytes remain losslessly represented as
54+
* Packed tag names containing non-UTF-8 bytes are represented losslessly as
5555
surrogate-escaped strings. ``safe_encode()`` recovers their original bytes,
5656
and Gix reference validation and resolution receive those bytes directly.
5757
* Raw diffs preserve non-UTF-8 filename bytes in ``a_rawpath``, ``b_rawpath``,
5858
and raw rename fields. Staged-file diffs no longer fail while decoding legacy
5959
filenames; blob contents remain byte streams regardless of their encoding.
60-
* ``Tree.cache`` and ``TreeModifier`` remain supported. They edit one tree's
61-
in-memory entries; object IDs and parent trees do not change automatically.
62-
Tree serialization now delegates construction to Git or the supported Gix
63-
backend. Prefer ``IndexFile.write_tree()`` for changes to staged paths.
60+
* Tree serialization now delegates construction to Git or the supported Gix
61+
backend. ``Tree.cache`` and ``TreeModifier`` edit one tree's in-memory entries;
62+
object IDs and parent trees do not change automatically. Prefer
63+
``IndexFile.write_tree()`` for changes to staged paths.
6464
* ``Commit.stats`` preserves Unicode line separators in filenames when
6565
``core.quotePath=false``. Git's LF-delimited output remains intact for root,
66-
subsequent and empty commits, including the Gix backend's existing filename
66+
subsequent and empty commits, including the Gix backend's filename
6767
quoting fallback.
68-
* ``GitConfigParser[section] = values`` again replaces a nonempty section,
69-
restoring Kas's Git identity cleanup. Git performs each mutation and locks
70-
it independently; replacement is not one atomic transaction. Empty sections
71-
and ``add_section()`` remain unsupported, including Kas's SSH key setup.
72-
* Explicit ``from git import Union`` and ``Optional`` imports remain available
73-
for Demisto SDK's validator registration and MkDocs RSS Plugin imports,
74-
retaining the historical ``typing`` aliases.
75-
* Editable/source imports expose the release version in ``git.__version__``,
76-
matching built distributions. Salt's GitPython provider checks can parse the
77-
version instead of rejecting the unstamped ``"git"`` build placeholder.
68+
* Imports from a source checkout now read ``git.__version__`` from ``VERSION``.
69+
Built wheels and source distributions continue to carry their stamped release
70+
version.
7871
* ``Repo`` construction validates repository configuration through Git/Gix.
7972
A subclass override of ``config_reader()`` no longer controls discovery or
8073
suppresses its include graph. Malformed configuration and invalid repository
81-
extensions can fail before downstream custom validation runs. sbxloop's
82-
metadata-reader subclass exposes this remaining compatibility break; callers
83-
must prepare their trusted metadata view before opening it with ``Repo``.
84-
* Revision root trees such as ``Repo.rev_parse("HEAD:")`` retain their empty
85-
path and can be iterated. Missing paths within a valid tree revision retain
86-
``Tree.join()``'s ``KeyError`` and missing-component message, restoring MCP
87-
Server Git's directory display and path-error reporting.
74+
extensions can fail before downstream custom validation runs. Callers using
75+
custom metadata views must prepare them before opening with ``Repo``.
8876
* ``Head.tracking_branch()`` returns a local ``Head`` when Git configures the
8977
current repository (``branch.<name>.remote=.``) as the upstream, instead of
9078
constructing an invalid ``refs/remotes/./...`` reference. Git resolves the
@@ -133,16 +121,21 @@ API changes
133121
* ``GitConfigParser`` uses Git's configuration syntax and canonical key spelling,
134122
and no longer subclasses ``configparser.RawConfigParser``.
135123
Common getters, typed values, duplicate values, file/stream inputs and mutation
136-
methods remain. Invalid Git syntax previously accepted by Python is rejected.
137-
Empty-section creation and valueless writes are removed; valueless reads remain.
138-
Relative includes from streams are rejected by Git. Locks cover each native
139-
mutation rather than the writer object's lifetime.
124+
methods remain, including ``GitConfigParser[section] = values`` for replacing
125+
nonempty sections. Invalid Git syntax previously accepted by Python is rejected.
126+
Empty-section creation, including ``add_section()``, and valueless writes are
127+
removed; valueless reads remain. Relative includes from streams are rejected
128+
by Git. Locks cover each native mutation rather than the writer object's
129+
lifetime; replacing a section is not one atomic transaction.
140130
* ``Submodule.rename()`` is removed. Moving a submodule preserves its logical name,
141131
matching Git. Normal removal retains Git's recoverable submodule metadata.
142132
Re-adding with ``no_checkout=True`` can reuse that metadata without changing refs;
143133
incompatible URLs, branches, and clone-only options are rejected before mutation.
144134
Fetch/pull results are derived from command output rather than ``FETCH_HEAD``
145-
file parsing. Revision strings follow Git's native revision grammar.
135+
file parsing. Revision strings follow Git's native revision grammar. Root trees
136+
such as ``Repo.rev_parse("HEAD:")`` have an empty path and can be iterated.
137+
Missing paths within a valid tree revision raise ``Tree.join()``'s ``KeyError``
138+
with its missing-component message.
146139

147140
* ``IndexFile.entries`` returns an immutable snapshot keyed by ``(path, stage)``
148141
for compatibility with existing readers. Each access queries the current
@@ -166,8 +159,8 @@ API changes
166159
* Commit/tag metadata uses structured Gix decoders when the Gix backend supports
167160
the repository. The CLI backend retains raw decoding because Git has no faithful
168161
formatted query for all commit headers or arbitrary tag objects. ``gpgsig``
169-
remains readable. The small ``Actor.from_string()`` and
170-
``parse_actor_and_date()`` identity helpers remain supported.
162+
remains readable. ``Actor.from_string()`` and ``parse_actor_and_date()`` provide
163+
identity parsing.
171164
* ``parse_date()`` delegates text syntax and timezone interpretation to Git;
172165
aware datetimes retain direct conversion and invalid inputs raise ``ValueError``.
173166
ISO/RFC dates now apply their timezone to the UTC timestamp, correcting the
@@ -182,9 +175,10 @@ API changes
182175
``Actor.from_string``), ``git.util.Iterable`` (use ``IterableObj``),
183176
``git.compat.is_win/is_posix/is_darwin`` (use ``os.name``/``sys.platform``), and
184177
``git.types.Lit_commit_ish`` (use ``Literal["commit", "tag"]`` or
185-
``GitObjectTypeString``). Top-level typing exports and private module aliases
186-
are removed; import from ``typing`` or the owning module. ``git.util`` now
187-
exposes the actual utility module. Abstract ``Traversable.traverse`` and
178+
``GitObjectTypeString``). Top-level typing exports other than explicit
179+
``Union`` and ``Optional`` imports are removed, along with private module
180+
aliases; import from ``typing`` or the owning module. ``git.util`` now exposes
181+
the actual utility module. Abstract ``Traversable.traverse`` and
188182
``list_traverse`` raise ``NotImplementedError``; use concrete implementations.
189183
* Paths and URLs no longer expand ``$VAR``/``%VAR%`` automatically. ``Repo``
190184
still accepts ``expand_vars=False`` for callers that explicitly select literal
@@ -1145,10 +1139,6 @@ Please note that due to breaking changes, we have to increase the major version.
11451139
* CRITICAL: fixed incorrect `Commit` object serialization when authored or commit date had timezones which were not
11461140
divisiblej by 3600 seconds. This would happen if the timezone was something like `+0530` for instance.
11471141
* A list of all additional fixes can be found `on GitHub <https://github.com/gitpython-developers/GitPython/issues?q=milestone%3A%22v1.0.2+-+Fixes%22+is%3Aclosed>`__
1148-
* Historical correction: ``Tree.cache`` was announced as removed, but the interface
1149-
remained available. Its current behavior and limitations are documented in
1150-
:class:`~git.objects.tree.TreeModifier`. Prefer ``IndexFile.write_tree()`` when
1151-
building trees from the staging area.
11521142

11531143
1.0.1 - Fixes
11541144
=============

‎doc/source/intro.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Overview / Install
66

77
GitPython is a python library used to interact with git repositories, high-level like git-porcelain, or low-level like git-plumbing.
88

9-
It provides Python objects for repository data and delegates Git operations to the Git executable. The default backend supports both SHA-1 and SHA-256 object IDs and both files and reftable reference storage. The legacy pure-Python GitDB backend is removed.
9+
It provides Python objects for repository data and delegates Git operations to the Git executable. The default backend supports both SHA-1 and SHA-256 object IDs and both files and reftable reference storage. ``GitDB`` is an alias for ``GitCmdObjectDB``; the pure-Python storage implementation is unavailable.
1010

1111
The object database implementation is optimized for handling large quantities of objects and large datasets, which is achieved by using low-level structures and data streaming.
1212

‎doc/source/tutorial.rst‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,9 +548,10 @@ resolves abbreviated object IDs through persistent ``git cat-file`` processes::
548548
# Equivalent explicit selection:
549549
repo = Repo("path/to/repo", odbt=GitCmdObjectDB)
550550

551-
Only ``GitCmdObjectDB`` and subclasses can be selected through ``odbt``. The
552-
legacy ``GitDB`` backend is removed. The ``gitdb`` package remains a dependency
553-
for shared types and utilities.
551+
Only ``GitCmdObjectDB`` and subclasses can be selected through ``odbt``.
552+
``GitDB`` is an alias for ``GitCmdObjectDB``; passing ``odbt=GitDB`` selects the
553+
same backend. The pure-Python storage implementation is unavailable. The
554+
``gitdb`` package provides shared types and utilities.
554555

555556
Git Command Debugging and Customization
556557
***************************************

‎fuzzing/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ Contains Python files for each fuzz test.
7171
**Things to Know**:
7272

7373
- Each fuzz test targets a specific part of GitPython's functionality.
74-
- Repository and object targets exercise Git-backed workflows. Removed Python index/tree binary parsers are no longer
75-
fuzz targets; malformed configuration and object IDs can now be rejected by Git or by Python input validation.
74+
- Repository and object targets exercise Git-backed workflows. Git or Python input validation may reject malformed
75+
configuration and object IDs.
7676
- Test files adhere to the naming convention: `fuzz_<API Under Test>.py`, where `<API Under Test>` indicates the
7777
functionality targeted by the test.
7878
- Any functionality that involves performing operations on input data is a possible candidate for fuzz testing, but

‎git/db.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,5 @@ def partial_to_complete_sha_hex(self, partial_hexsha: str) -> bytes:
109109
raise BadObject(partial_hexsha) from exc
110110

111111

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.
112+
# Keep the public backend selector using the same Git/Gix-managed storage.
114113
GitDB = GitCmdObjectDB

‎git/objects/tree.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ def cmp(a: str, b: str) -> int:
5757
class TreeModifier:
5858
"""Edit the entries cached by one :class:`Tree` instance.
5959
60-
This interface is supported; it is not deprecated. Changes affect only that
61-
instance's in-memory entries. They do not update its object ID, the stored tree,
62-
parent trees, the index, or any commit. Call :meth:`set_done` to restore entry
63-
order for iteration after editing.
60+
Changes affect only that instance's in-memory entries. They do not update its
61+
object ID, the stored tree, parent trees, the index, or any commit. Call
62+
:meth:`set_done` to restore entry order for iteration after editing.
6463
6564
Tree serialization delegates construction and ordering to Git or the supported
6665
Gix backend. Prefer :class:`~git.index.base.IndexFile` and

‎git/repo/base.py‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ def __init__(
266266
Object DataBase type - a type which is constructed by providing the
267267
directory containing the database objects, i.e. ``.git/objects``. It will be
268268
used to access all object data. Only :class:`~git.db.GitCmdObjectDB`
269-
and its subclasses are supported.
269+
and its subclasses are supported. ``GitDB`` is an alias for
270+
``GitCmdObjectDB``.
270271
271272
:param search_parent_directories:
272273
If ``True``, all parent directories will be searched for a valid repo as
@@ -276,9 +277,8 @@ def __init__(
276277
GitPython, which is considered a bug though.
277278
278279
:param expand_vars:
279-
The legacy ``False`` option remains accepted to select literal paths.
280-
``True`` is unsupported; expand environment variables explicitly
281-
before opening a repository. Initial ``~`` expansion remains enabled.
280+
Only ``False`` is supported. Expand environment variables explicitly
281+
before opening a repository. Initial ``~`` expansion is enabled.
282282
283283
:raise git.exc.InvalidGitRepositoryError:
284284
@@ -1602,7 +1602,8 @@ def init(
16021602
Object DataBase type - a type which is constructed by providing the
16031603
directory containing the database objects, i.e. ``.git/objects``. It will be
16041604
used to access all object data. Only :class:`~git.db.GitCmdObjectDB`
1605-
and its subclasses are supported.
1605+
and its subclasses are supported. ``GitDB`` is an alias for
1606+
``GitCmdObjectDB``.
16061607
16071608
:param allow_unsafe_options:
16081609
Allow unsafe options to be used, such as ``--template`` and
@@ -1786,8 +1787,8 @@ def clone(
17861787
:param kwargs:
17871788
* ``odbt`` = ObjectDatabase Type, allowing to determine the object database
17881789
implementation used by the returned :class:`Repo` instance. The
1789-
backend must be ``GitCmdObjectDB`` or its subclass; use the default
1790-
:class:`~git.db.GitCmdObjectDB` instead.
1790+
backend must be :class:`~git.db.GitCmdObjectDB` or its subclass.
1791+
``GitDB`` is an alias for ``GitCmdObjectDB``.
17911792
* All remaining keyword arguments are given to the :manpage:`git-clone(1)`
17921793
command.
17931794

0 commit comments

Comments
 (0)