Skip to content

Add tests for Repository::open_mailmap and open_mailmap_into#2622

Open
Amey Pawar (ameyypawar) wants to merge 1 commit into
GitoxideLabs:mainfrom
ameyypawar:tests/repository-mailmap
Open

Add tests for Repository::open_mailmap and open_mailmap_into#2622
Amey Pawar (ameyypawar) wants to merge 1 commit into
GitoxideLabs:mainfrom
ameyypawar:tests/repository-mailmap

Conversation

@ameyypawar
Copy link
Copy Markdown

What

Adds integration tests for gix::Repository::open_mailmap() and open_mailmap_into(), addressing the two // TODO: tests markers in gix/src/repository/mailmap.rs.

Two cases are covered:

  1. Empty case — a repo with no .mailmap, no mailmap.blob, and no mailmap.file yields an empty Snapshot, and open_mailmap_into returns Ok(()). Reuses the existing make_basic_repo.sh fixture (no new fixture needed).
  2. Worktree .mailmap — a new minimal fixture make_mailmap_repo.sh checks that an entry remapping a name by email is loaded from the worktree root and applied via Snapshot::try_resolve.

Out of scope (deliberately)

To keep the PR small, three remaining source paths documented on open_mailmap_into are left for a follow-up:

  • mailmap.blob (revspec config)
  • mailmap.file (filesystem-path config, follows symlinks)
  • Bare-repo fallback to HEAD:.mailmap when mailmap.blob is unset

Verification

  • cargo test -p gix --test gix repository::mailmap — 2 passed
  • cargo test -p gix --test gix repository — 146 passed
  • Same under GIX_TEST_FIXTURE_HASH=sha256 — 146 passed
  • cargo fmt --check + cargo clippy -p gix --tests --no-deps -- -D warnings — clean
  • Both make_mailmap_repo.tar (SHA1) and make_mailmap_repo_sha256.tar (SHA256) generated and committed under gix/tests/fixtures/generated-archives/, matching repo convention.

Disclosure

This PR was drafted with AI assistance (Claude Code) under my review and direction. I designed the scope, reviewed every line, and ran the verification myself before pushing.

Covers two of the four mailmap source paths documented on
open_mailmap_into: the no-source case (empty snapshot, no error)
via the existing make_basic_repo.sh fixture, and the worktree
.mailmap case via a new make_mailmap_repo.sh fixture.

The remaining sources (mailmap.blob, mailmap.file, bare repo
HEAD:.mailmap) are intentionally deferred to a follow-up to keep
this change small.

Also removes the two // TODO: tests markers in
gix/src/repository/mailmap.rs.
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.

1 participant