Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] ignores branch or rev #14466

Closed
fenollp opened this issue Aug 28, 2024 · 1 comment
Closed

[patch] ignores branch or rev #14466

fenollp opened this issue Aug 28, 2024 · 1 comment
Labels
A-git Area: anything dealing with git A-patch Area: [patch] table override C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@fenollp
Copy link

fenollp commented Aug 28, 2024

Problem

Specifying a [patch] for a (git) crate does not take branch (or rev (and maybe also tag)) into account:

[workspace.dependencies.my-crate]
git = "ssh://[email protected]/myslug/myrepo.git"
branch = "main"

[patch."ssh://git@myhost.net/myslug/myrepo.git".my-crate]
git = "ssh://[email protected]/myslug/myrepo.git"
branch = "not-main"
error: failed to resolve patches for `ssh://[email protected]/myslug/myrepo.git`

Caused by:
  patch for `my-crate` in `ssh://[email protected]/myslug/myrepo.git` points to the same source, but patches must point to different sources

Steps

cargo fetch

Possible Solution(s)

A trick that works is to append an empty fragment to the end of the git URL.

This works:

[workspace.dependencies.my-crate]
git = "ssh://[email protected]/myslug/myrepo.git"
branch = "main"

[patch."ssh://git@myhost.net/myslug/myrepo.git".my-crate]
git = "ssh://[email protected]/myslug/myrepo.git#"  # <--- here
branch = "not-main"

Notes

  1. IMO the patch system should take branch, rev or tag into account as that "points to different sources"
  2. An empty fragment in a git URL should not be used when comparing URLs (but please don't fix that yet!)

Version

cargo 1.80.1 (376290515 2024-07-16)
release: 1.80.1
commit-hash: 37629051518c3df9ac2c1744589362a02ecafa99
commit-date: 2024-07-16
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 24.4.0 (noble) [64-bit]
@fenollp fenollp added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Aug 28, 2024
@weihanglo
Copy link
Member

Thanks for the issue report! This is a dupe of #5478. Close in favor of that.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
@weihanglo weihanglo added A-git Area: anything dealing with git A-patch Area: [patch] table override labels Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-git Area: anything dealing with git A-patch Area: [patch] table override C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants