Skip to content

UPSTREAM PR #2412: feat: add Rust closure fixtures to gix-testtools#18

Open
loci-dev wants to merge 2 commits intomainfrom
loci/pr-2412-copilot-add-execute-rust-closures-again
Open

UPSTREAM PR #2412: feat: add Rust closure fixtures to gix-testtools#18
loci-dev wants to merge 2 commits intomainfrom
loci/pr-2412-copilot-add-execute-rust-closures-again

Conversation

@loci-dev
Copy link
Copy Markdown

@loci-dev loci-dev commented Feb 4, 2026

Note

Source pull request: GitoxideLabs/gitoxide#2412

Adds ability to create fixtures using Rust closures instead of shell scripts, with manual version numbers for cache invalidation.

New API

  • rust_fixture_read_only(name, version, closure) - cached read-only fixture
  • rust_fixture_writable(name, version, mode, closure) - writable temp directory copy
  • *_standalone variants for fixtures/ instead of tests/fixtures/

Implementation

  • Version number (u32) replaces CRC-based script identity for cache invalidation
  • Archives prefixed with rust- (e.g., rust-my_fixture.tar.xz)
  • Reuses existing locking, archive extraction, and failure marker infrastructure

Example

let dir = gix_testtools::rust_fixture_read_only("my_fixture", 1, |dir| {
    std::fs::write(dir.join("file.txt"), "content")?;
    Ok(())
})?;

Increment version when closure behavior changes to force cache rebuild.

Original prompt

Add a way to execute Rust closures on a given directory in the gix-testtools crate, fully integrated into the existing ways of creating fixtures with scripts. The key here is to let the caller provide a version number (simple integer), that needs to be incremented manually to allow caching.
With it, it should be possible to make a fixture something like this:

let dir = gix_testtools::rust_fixture_read_only(1, |dir| { …create the fixture in Rust here })?;

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Byron added 2 commits February 4, 2026 07:12
Reviewed-by: Claude <noreply@anthropic.com>
@loci-review
Copy link
Copy Markdown

loci-review Bot commented Feb 4, 2026

The analysis encountered an error. Please review the Processing Details for more information.

@loci-dev loci-dev force-pushed the main branch 7 times, most recently from a4396e6 to bdb09ad Compare February 11, 2026 07:20
@loci-dev loci-dev force-pushed the main branch 4 times, most recently from 9af85dc to 8124417 Compare February 16, 2026 07:50
@loci-dev loci-dev force-pushed the main branch 5 times, most recently from 1a1cf0a to f045646 Compare February 25, 2026 07:50
@loci-dev loci-dev force-pushed the main branch 2 times, most recently from e746ced to fe5de3e Compare March 4, 2026 07:46
@loci-dev loci-dev force-pushed the main branch 4 times, most recently from 2c4a72b to 167bdd1 Compare March 13, 2026 07:48
@loci-dev loci-dev force-pushed the main branch 3 times, most recently from 9b41e5f to 1f13824 Compare March 21, 2026 07:44
@loci-dev loci-dev force-pushed the main branch 7 times, most recently from 06bc48e to 0e47b1e Compare March 30, 2026 07:05
@loci-dev loci-dev force-pushed the main branch 2 times, most recently from 8b02847 to 1bf0519 Compare April 2, 2026 07:54
@loci-dev loci-dev force-pushed the main branch 3 times, most recently from cdbe120 to 78a7ab5 Compare April 11, 2026 07:49
@loci-dev loci-dev force-pushed the main branch 6 times, most recently from 49231d8 to bc0a777 Compare April 20, 2026 07:18
@loci-dev loci-dev force-pushed the main branch 4 times, most recently from e902b63 to c6739bc Compare April 27, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants