Uh oh!
There was an error while loading. Please reload this page.
Improve pure Python rev-parse coverage and behavior - #2136
Conversation
Port object-resolving revspec cases inspired by gix-revision into deterministic GitPython tests, without shelling out to Git or Gix at runtime. Refactor rev_parse handling around anchors, navigation, peeling, reflog selectors, path/index lookups, describe-style names, and commit-message searches. Document observed Git/Gix behavior differences and the GitPython choices made for user-facing compatibility. Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
5372b44 to
d7ce6fcCompareThere was a problem hiding this comment.
Pull request overview
This PR addresses issue #2135 by updating GitPython’s revision parsing so Repo.commit()/rev_parse() can resolve tag names that start with @ (e.g., @foo) without misinterpreting them as reflog syntax.
Changes:
- Add regression tests for
repo.commit("@foo")and forrev_parse()handling of names beginning with@. - Refactor and extend
rev_parse()parsing logic to better distinguish tokens vs. literal@in ref names, and to support additional rev-parse forms. - Add helper functions for reflog parsing, message search, and describe-style name resolution.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
git/repo/fun.py | Refactors rev_parse() tokenization and adds helpers for reflog/message-search/describe parsing to prevent @-prefixed tags from failing. |
test/test_repo.py | Adds a regression test covering Repo.commit() with a tag name starting with @. |
test/test_rev_parse.py | Introduces a new pytest module covering rev_parse() behavior for @ names, navigation/peeling, reflog selectors, and invalid specs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Adds expanded revision-spec parsing behavior and a dedicated test suite to increase deterministic coverage of Repo.rev_parse edge cases (describe-style names, navigation/peeling, reflog selectors, index/tree path lookups, and commit-message searches).
Changes:
- Introduce a new
test/test_rev_parse.pywith targeted revspec cases and a purpose-built repo fixture. - Extend
git/repo/fun.py::rev_parseand helpers to support additional revspec forms (describe-style names, reflog selectors, path/index lookups, and message searches). - Add/adjust tests in
test/test_repo.pyfor tags starting with@and make reflog-history assertions more robust.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/test_rev_parse.py | New focused rev-parse test suite and fixture repo construction. |
test/test_repo.py | Adds regression coverage for @foo tags and stabilizes a reflog assertion. |
git/repo/fun.py | Refactors/enhances rev_parse with new parsing helpers and added revspec support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
96942dd to
6cf7ac3CompareUh oh!
There was an error while loading. Please reload this page.
Port object-resolving revspec cases inspired by gix-revision into deterministic GitPython tests, without shelling out to Git or Gix at runtime. Refactor rev_parse handling around anchors, navigation, peeling, reflog selectors, path/index lookups, describe-style names, and commit-message searches.
Document observed Git/Gix behavior differences and the GitPython choices made for user-facing compatibility.