Skip to content

test: isolate repository fixtures and restore Windows reference coverage - #2341

Merged
Byron merged 4 commits into
mainfrom
fix-ci
Nov 5, 2026
Merged

Byron merged 4 commits into
mainfrom
fix-ci

Conversation

@Byron

@Byron Byron commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Tasks

  • refackiew

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

GitPython's Windows CI exposed invalid reference paths in a PathLike test,
while its test fixtures depended on the source checkout's history and refs.
This work makes PR, post-merge, and source-archive test runs exercise the same
inputs, and restores portable reference-argument coverage.

  • Generate GitPython histories, submodule scenarios, GitDB packed/loose objects,
    and benchmark repositories from fixture scripts. Preserve the existing test
    scenarios through named revisions, remove the history bootstrap, and run CI
    after removing source Git metadata.
  • Use PurePosixPath for Git reference names so Windows keeps forward slashes
    while retaining PathLike coverage and production reference validation.
  • Fingerprint package and benchmark harness sources without requiring source
    Git metadata. Report actual processed-object counts in GitDB benchmark rates.

The benchmark workload is now generated, so old history-based timings are not
comparable. Local validation for the review fixes: seven comparison tests and
five GitDB performance tests pass; an output check verifies totals and rates
against the 90-object fixture. The harness-only regression failed before the
fix. Ruff lint and formatting checks pass. CI is running on the updated head.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐ŸŸข Approval recommended

No active review issues are reported for this test-only change to make Git reference-path coverage platform-independent.

No open issues ๐ŸŽ‰

What changed in this PR

This test-only change fixes Windows failures in PathLike revision-argument coverage without changing production reference validation.

Changes:

  • Use PurePosixPath for Git reference names so separators remain forward slashes on every platform.
  • Preserve PathLikeMock coverage and retain native Path for filesystem operations.

Reviewed by GitHub Copilot.

File Description
test/โ€‹test_refs.py Import PurePosixPath and use it in the revision-argument test parameterization.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 5, 2026 08:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐ŸŸก Changes recommended

Benchmark fingerprints omit harness changes, allowing misleading workload comparisons, while throughput calculations use iteration limits rather than actual processed counts, inflating reported rates.

2 open issues

Review effort: Balanced

Comment thread gitdb/gitdb/test/fixtures/repository.sh Resolved
Comment thread test/performance/bench_repository.py Resolved
Byron and others added 3 commits November 5, 2026 09:59
<!-- agent -->
Restore Windows CI coverage for `PathLike` revision arguments. The test
introduced in `6de90f1c` uses `Path("refs/heads/main")`, which emits
backslashes on Windows. Those are invalid Git reference names, so resolving
`SymbolicReference` fails during ref-name validation in all four
files/reftable and SHA-1/SHA-256 variants. The same failures were already
present in PR #2336, before the unrelated `patch_env()` change in PR #2340.

Use `PurePosixPath` for the test's Git reference names, which use forward
slashes on every platform. It still implements `os.PathLike`, preserving
coverage through `SymbolicReference` and direct and nested `merge_base()`
arguments alongside `PathLikeMock`. Keep native `Path` for filesystem
operations elsewhere in the module and preserve production validation.

Assisted-by: GPT 6.1 Sol
Co-authored-by: GPT 6.1 Sol <codex@openai.com>
Took a quick look, pretty zoomed out, but think it's
a desirable change as finally the test-suite is independent
of the input repository or state.

<!-- agent -->
Make PR and post-merge test results independent of checkout depth, refs,
and history. The shared test repository and dependency clone sources
previously came from the source checkout, requiring historical objects
and a bootstrap script even though setup already used `gix.testtools`.

Generate small repositories from scratch through `gix.testtools`, with
named root, release, merge, conflict, rename, date, and submodule states.
Adapt legacy assertions to those scenarios while retaining merge,
serialization, traversal, index, remote, and nested-submodule coverage.
Make dirty-submodule removal checks explicit for staged, unstaged, and
untracked data, including dry runs.

Remove the source-history environment override, dependency factory,
checkout lock cleanup, and bootstrap script. The main CI suites now use
shallow checkouts and remove source `.git` metadata before pytest. Add a
regression that initializes the shared fixture from a source copy without
Git metadata, and document the isolation requirement. Hash raw parser
samples in cache arguments to avoid archive filename limits on cold runs.

Assisted-by: GPT 6.0 Astra
Co-authored-by: GPT 6.0 Astra <codex@openai.com>
<!-- agent -->
GitDB tests previously opened the source checkout's `.git` directory or
`GITDB_TEST_GIT_REPO_BASE`, making their input depend on clone history.
Give each test class a disposable repository generated by a fixture
script, with packed history and additional loose objects. Isolate Git
configuration and identity during setup and register class cleanup.

Run the script with Bash so the standalone suite retains Python 3.8
support without adding a GixPython dependency. Remove the history override
and full-depth checkout from dependency CI, remove source `.git` before
running the suite, and document the new setup.
Use the actual database size when writing a pack instead of the unrelated
iteration count, which the smaller fixture exposed.

Assisted-by: GPT 6.0 Astra
Co-authored-by: GPT 6.0 Astra <codex@openai.com>
Copilot AI balanced review requested due to automatic review settings November 5, 2026 09:03
@Byron Byron changed the title test(refs): use POSIX paths for Git reference names test: isolate repository fixtures and restore Windows reference coverage Nov 5, 2026
โ€ฆcounts

<!-- agent -->
Address benchmark review feedback on the generated fixtures. Copilot noted
that "performance tests still report their iteration limits of 1,000โ€“10,000
as processed counts" even though the fixture has only 90 packed objects.
Use the existing streaming counters and clamp list-based limits to the
available SHA count so both totals and throughput reflect completed work.

Copilot also requested: "Include the benchmark harness sources in the
fingerprint, and add a harness-only change to the digest regression test."
Hash the Python sources in `test/performance` alongside `VERSION` and `git`.
This prevents comparing different timed workloads that return the same
result. Extend the generated source fixture and document the digest scope.

Assisted-by: GPT 6.0 Astra
Co-authored-by: GPT 6.0 Astra <codex@openai.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐ŸŸข Approval recommended

No active review issues are recorded that would block approval.

No open issues ๐ŸŽ‰

2 resolved since last review

Review effort: Balanced

@Byron
Byron merged commit 34dfb13 into main Nov 5, 2026
67 checks passed
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.

2 participants