Skip to content

cargo: Support git tag/rev updates in workspace manifest#14575

Open
IraSkyx wants to merge 1 commit into
dependabot:mainfrom
IraSkyx:cargo/workspace-git-pin-updates
Open

cargo: Support git tag/rev updates in workspace manifest#14575
IraSkyx wants to merge 1 commit into
dependabot:mainfrom
IraSkyx:cargo/workspace-git-pin-updates

Conversation

@IraSkyx
Copy link
Copy Markdown

@IraSkyx IraSkyx commented Mar 30, 2026

What are you trying to accomplish?

WorkspaceManifestUpdater only knew how to bump version = "..." 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 what ManifestUpdater already 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_pin method follows the same structure as the existing update_workspace_version: try inline section first, fall back to table-header notation. The workspace_section_regex and table_header_regex helpers 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:

-utf8-ranges = { git = "https://github.com/BurntSushi/utf8-ranges", tag = "0.1.3" }
+utf8-ranges = { git = "https://github.com/BurntSushi/utf8-ranges", tag = "1.0.4" }

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@IraSkyx IraSkyx requested a review from a team as a code owner March 30, 2026 13:58
Copilot AI review requested due to automatic review settings March 30, 2026 13:58
@github-actions github-actions Bot added the L: rust:cargo Rust crates via cargo label Mar 30, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 WorkspaceManifestUpdater to rewrite tag/rev pins 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: rust:cargo Rust crates via cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Cargo workspace manifest git tag update

2 participants