Repository navigation
BREAKING CHANGES for v4.0 - #2177
Closed
Byron wants to merge 2 commits into
main from
v4-breaking
Closed
Conversation
Copy link
Copy Markdown
Member
In order to make progress, at some point there should be a mildly breaking release.
For now not much is planned, except that it's worth a try.
The alternative is to see if what's planned as V4 can work for V3 users out of the box.
Changes
- a native python and conformant git config implementation. Breaking because it's won't need workarounds.
- fix
__del__ and make object destruction deterministic again (maybe exceptions keep objects alive)
-
Git class facade that avoids dynamic calls in favor of statically defined and documented ones.
Other possibilities, maybe not breaking
- discovery of dynamic methods and code-intelligence, as extracted from docs, for basedpyright and mypi maybe.
Byron
added this to the
v4.0 milestone
Jul 20, 2026
Byron
force-pushed
the
v4-breaking
branch
from
75263ac to
a44f8d9
Compare
July 20, 2026 13:40
Byron
force-pushed
the
v4-breaking
branch
2 times, most recently
from
607513c to
ed6a3d2
Compare
August 4, 2026 15:28
feat: rewrite config parser to be consistent with Git
4c260e4
Previously it was based on an ini-parser, which depends on the
Python version and also isn't actually dealing with the Git's
specific grammar and rules.
Now it's much more consistent, albeit probably also slower.
--- agent
Replace the line-oriented INI parsing logic in GitConfigParser with a
character-stream parser modeled on Git's config.c implementation.
The inherited configparser section matcher treats everything between the
first opening bracket and the last closing bracket as one section name.
Consequently, GitPython interpreted a header such as:
[user] [other]
as one section named "user] [other", while Git interpreted it as two
successive section headers and assigned following values to "other".
Writing opaque section names through the INI serializer could therefore
change the configuration's meaning when Git subsequently read it.
Implement Git's configuration grammar directly, following the behavior of
git_parse_source(), get_base_var(), get_value(), and parse_value(). The new
parser handles:
- basic and quoted-subsection section headers
- multiple section headers in the same character stream
- comments introduced by '#' or ';'
- quoted and unquoted values
- supported backslash escapes
- backslash-newline continuations
- leading and trailing whitespace rules
- CRLF input and UTF-8 byte-order marks
- entries without values, represented semantically as boolean true
- duplicate options while preserving their order
Reject syntax that Git itself rejects, including colon delimiters,
underscore-containing option names, malformed section headers, unknown
value escapes, and unterminated quoted values.
Replace the raw value writer with a canonical Git-config serializer.
Values are always quoted, with backslashes, quotes, newlines, tabs, and
backspaces escaped. Quoted subsection names are parsed and re-escaped
canonically before being written. Comments and original whitespace remain
intentionally unpreserved when a dirty configuration is flushed.
Validate section names by parsing them as complete Git section headers.
This ensures each supplied name identifies exactly one section and
prevents unquoted closing brackets from injecting another section.
Validate option names against Git's ASCII letter, digit, and hyphen
grammar as well.
Update fixtures that previously depended on INI syntax rejected by Git,
and adjust expectations for decoded value escapes and valueless boolean
entries.
Add coverage for:
- the differing interpretation of adjacent section headers
- BOM, CRLF, comments, continuations, and valueless entries
- malformed syntax rejected by Git
- canonical value serialization and reparsing
- real `git config` interoperability
- closing brackets inside quoted subsection names
- quotes and backslashes inside subsection names
- invalid section and option names
- duplicate-value behavior with Git-compatible option names
Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Byron
force-pushed
the
v4-breaking
branch
from
ed6a3d2 to
4c260e4
Compare
August 10, 2026 12:12
halstead
pushed a commit
to openembedded/openembedded-core
that referenced
this pull request
Aug 30, 2026
python3-git: upgrade 3.1.60 -> 3.1.61
4843310
Source: doc/source/changes.rst
3.1.61
======
A fixup release to avoid accidental removal of public class regex on Actor.
It's now deprecated instead.
If you can, also try and provide feedback on the upcoming v4 branch
gitpython-developers/GitPython#2177 - patches welcome.
See the following for all changes.
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.61
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead
pushed a commit
to openembedded/openembedded-core
that referenced
this pull request
Aug 31, 2026
python3-git: upgrade 3.1.60 -> 3.1.61
8485f09
Source: doc/source/changes.rst
3.1.61
======
A fixup release to avoid accidental removal of public class regex on Actor.
It's now deprecated instead.
If you can, also try and provide feedback on the upcoming v4 branch
gitpython-developers/GitPython#2177 - patches welcome.
See the following for all changes.
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.61
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead
pushed a commit
to openembedded/openembedded-core
that referenced
this pull request
Sep 1, 2026
python3-git: upgrade 3.1.60 -> 3.1.61
c012ce3
Source: doc/source/changes.rst
3.1.61
======
A fixup release to avoid accidental removal of public class regex on Actor.
It's now deprecated instead.
If you can, also try and provide feedback on the upcoming v4 branch
gitpython-developers/GitPython#2177 - patches welcome.
See the following for all changes.
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.61
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
halstead
pushed a commit
to openembedded/openembedded-core
that referenced
this pull request
Sep 2, 2026
python3-git: upgrade 3.1.60 -> 3.1.61
499d1d1
Source: doc/source/changes.rst
3.1.61
======
A fixup release to avoid accidental removal of public class regex on Actor.
It's now deprecated instead.
If you can, also try and provide feedback on the upcoming v4 branch
gitpython-developers/GitPython#2177 - patches welcome.
See the following for all changes.
https://github.com/gitpython-developers/GitPython/releases/tag/3.1.61
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
feat!: return None for detached refs and add HEAD.hexsha (#2230)
dd6f1c8
A detached HEAD currently turns a branch lookup into a TypeError. Return
None from SymbolicReference.reference (and its ref alias) and
Repo.active_branch. An unborn branch still exposes its reference.
Add repo.head.hexsha to read the hexadecimal object ID directly without
loading commit objects. Resolve loose and packed references in attached,
detached, bare, and linked-worktree repositories. Return None for an
unborn target, and raise for a missing HEAD, malformed or cyclic refs,
and failures to read reference data.
Distinguish missing references from other I/O errors so an unreadable
loose ref cannot silently fall back to a stale packed value. Replace the
empty-ref assertion with ValueError and detect symbolic-reference cycles.
Preserve revision lookup for branch names that overlap Git metadata paths.
Update conditional configuration includes, reflog and upstream lookups,
commit creation, checkout, and submodule tracking to handle optional
references. Relative submodule URLs use origin when HEAD is detached.
Update the tutorial and regression tests for the new API. Make writable
test clones usable from detached checkouts, give remote tests an explicit
master branch, and compare reflog results with Git instead of assuming
successive entries always name different commits.
Validation:
- 311 targeted tests passed using disposable clones and isolated Git
configuration, with additional detached-HEAD and feature-branch checks.
- Ruff lint and formatting checks passed; mypy passed for 45 source files.
- The pre-existing test_writer_rejects_invalid_option_names failure
remains: it expects an underscore-containing option name to be accepted,
while the config parser correctly rejects that Git-incompatible name.
81sdelliott-boop
approved these changes
Sep 15, 2026
View reviewed changes
EliahKagan
mentioned this pull request
Sep 20, 2026
Drop Python 3.7
#2246
Merged
Copy link
Copy Markdown
Member
Author
|
Abandoned in favor of another approach:
- CLI only version ready for Git3, with no Python implementation anymore
- A Gitoxide powered alternative that can be swapped in if Rust toolchain is available for performance.
|
Byron
closed this
Oct 5, 2026
Copilot PR reviewer
Copilot
AI
mentioned this pull request
Oct 14, 2026
new release
#2285
Merged
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment
Labels
None yet
3 participants