chore(deps): update git2 requirement from 0.20.4 to 0.21.0 in the cargo-dependencies group#174
Merged
MatejGomboc merged 5 commits intoMay 27, 2026
Conversation
Updates the requirements on [git2](https://github.com/rust-lang/git2-rs) to permit the latest version. Updates `git2` to 0.21.0 - [Changelog](https://github.com/rust-lang/git2-rs/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-lang/git2-rs/commits/git2-0.21.0) --- updated-dependencies: - dependency-name: git2 dependency-version: 0.21.0 dependency-type: direct:production dependency-group: cargo-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
git2 0.21 ships two breaking changes that broke the build: 1. `default` features became empty (0.20 enabled "ssh" + "https"). Request them explicitly so `Cred::credential_helper` (now gated behind the new transitive "cred" feature) resolves again. 2. `TreeEntry::name()` and `Commit::message()` now return `Result<&str, Error>` instead of `Option<&str>`. Switch the three tree-walk `let Some(name)` callbacks to `let Ok(name)` (preserving the skip-on-non-UTF-8 behaviour) and one test assertion to `Ok(..)`. Also replace the deprecated `Oid::zero()` with `Oid::ZERO_SHA1` in three submodule tests. Updated CHANGELOG. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The git2 0.21 `Some`→`Ok` migration touched two submodule walk callbacks (`find_submodule_entries` and `write_submodules_to_tar`) whose `let Ok(name) = entry.name()` lines were only exercised by the Python integration tests. Those don't run in the PR coverage job (ci_pr.yml is unit-tests-only), so Codecov patch coverage flagged them as uncovered changed lines (71.43% < 80% gate). Add three unit tests that close the gap without any network: - find_submodule_entries_detects_gitlink_in_tree / _gitlink_missing_ from_gitmodules_is_skipped: build a tree containing a real gitlink (mode 160000) entry and assert the entry is/ isn't returned. - write_submodules_to_tar_writes_submodule_files: drive the private write_submodules_to_tar against a locally-created bare repo via a new test-only FetchResult::from_parts_for_test constructor. Both previously-missed lines are now unit-covered; full suite is 597 unit tests. Updated CHANGELOG. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MatejGomboc
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Dependabot bump of
git20.20.4 → 0.21.0. The 0.21 release containsbreaking changes that broke the build, so this PR also carries the code
migration needed to compile against the new API. No behavioural change to
this crate — the credential relay and tree-streaming logic are functionally
identical to before.
1. Build migration
Upstream breaking changes addressed:
defaultCargo features became empty (0.20 wasdefault = ["ssh", "https"],0.21 is
default = []).Cargo.tomlnow requestsfeatures = ["https", "ssh"]explicitly — the exact set 0.20.4 enabled by default — which transitively
enables the new
credfeature that now gatesCred::credential_helper(used in
src/git2_ops/auth.rs).Result<&str, Error>instead ofOption<&str>(UTF-8 validation).
TreeEntry::name()callbacks instreaming/tar.rs(×2)and
git2_ops/submodule.rs(×1) changed fromlet Some(name) = …tolet Ok(name) = …, preserving the skip-on-non-UTF-8 behaviour; oneCommit::message()assertion in apush.rstest changed fromSome(..)to
Ok(..).Oid::zero()deprecated → replaced with theOid::ZERO_SHA1constant inthree
submodule.rstests (would otherwise fail under-D warnings).2. Coverage follow-up
Two of the migrated
let Ok(name)lines live in submodule walk callbacks(
find_submodule_entriesand the privatewrite_submodules_to_tar) that wereonly exercised by the Python integration tests. The PR coverage job
(
ci_pr.yml) is unit-tests-only, so Codecov patch coverage initially flaggedthose two changed lines as uncovered (71.43% < 80% gate). Added three unit
tests that close the gap with no network:
find_submodule_entries_detects_gitlink_in_treeandfind_submodule_entries_gitlink_missing_from_gitmodules_is_skipped— build atree containing a real gitlink (mode 160000) entry and assert it is / isn't
returned.
write_submodules_to_tar_writes_submodule_files— driveswrite_submodules_to_taragainst a locally-created bare repo via a newtest-only
FetchResult::from_parts_for_testconstructor.Verified locally with
cargo llvm-covthat both previously-missed lines arenow unit-covered. Full suite: 597 unit tests + integration.
Related Issue
N/A — automated dependency update.
Type of Change
Security Checklist⚠️
Since this is a credential-handling project:
src/git2_ops/auth.rs) — the feature-flag change re-enables the samecredential_helperpath; no caching introducedTesting
cargo test)Code Quality
cargo build)cargo clippy --all-targets --all-features -- -D warnings)cargo fmt --all --check)markdownlint-cli2 "**/*.md")bash .github/scripts/check-toolchain-pin.sh)Additional Notes
This branch has been pushed to manually, so Dependabot will no longer auto-rebase
or resolve conflicts on it (commenting
@dependabot recreatewould overwrite themigration commits). The upstream git2 0.21 changelog highlights are preserved below.
Upstream git2 0.21.0 changelog (key breaking changes)
From git2's changelog:
ssh,https, andcredCargo features are no longer enabled by default(was
default = ["ssh", "https"]; nowdefault = []). #1168CredentialHelperand theurldependency are now gated behind the newcredfeature; enabling
sshorhttpstransitively enablescred. #1168Option<&str>now returnResult<&str, Error>or
Result<Option<&str>, Error>. #1241Full diff: git2-0.20.4...git2-0.21.0
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version