cargo: Support git tag/rev updates in workspace manifest#14575
Open
IraSkyx wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for updating git-pinned workspace dependencies (tag/rev) in Cargo workspace manifests, so [workspace.dependencies] entries stay consistent with the updated Cargo.lock (closing #13219).
Changes:
- Extend
WorkspaceManifestUpdaterto rewritetag/revpins in[workspace.dependencies](both inline-table and table-header notation). - Refactor shared regex helpers used by workspace dependency updating to reduce duplication.
- Add fixtures and specs covering workspace git pin updates (tag + rev, inline + table-header).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
cargo/lib/dependabot/cargo/file_updater/workspace_manifest_updater.rb |
Implements workspace git pin rewriting and extracts shared section/header regex helpers. |
cargo/spec/dependabot/cargo/file_updater_workspace_spec.rb |
Adds integration-style spec ensuring the top-level updater rewrites a workspace git tag. |
cargo/spec/dependabot/cargo/file_updater/workspace_manifest_updater_spec.rb |
Adds focused unit coverage for tag/rev updates and both manifest notations. |
cargo/spec/fixtures/manifests/workspace_dependencies_git_tag |
New fixture for inline [workspace.dependencies] git tag/rev forms. |
cargo/spec/fixtures/manifests/workspace_dependencies_git_tag_table |
New fixture for table-header [workspace.dependencies.<name>] git tag/rev forms. |
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.
What are you trying to accomplish?
WorkspaceManifestUpdateronly knew how to bumpversion = "..."strings in[workspace.dependencies]. When a workspace dependency used a git pin (tag or rev), the updater silently skipped it, leaving the manifest with the old tag while Cargo.lock pointed at the new commit.This adds git pin rewriting logic to
WorkspaceManifestUpdater, mirroring whatManifestUpdateralready does for regular[dependencies]. Both inline table and table-header notation are handled.Closes #13219
Anything you want to highlight for special attention from reviewers?
The new
update_workspace_git_pinmethod follows the same structure as the existingupdate_workspace_version: try inline section first, fall back to table-header notation. Theworkspace_section_regexandtable_header_regexhelpers are extracted from the existing version-update code to reduce duplication.How will you know you've accomplished your goal?
A dry-run in the dev environment against a test repo with
[workspace.dependencies]using git + tag confirms the tag is rewritten in the diff:Checklist