Repository navigation
Conversation
Remote names differ between clones (e.g. `origin` vs `upstream` in a fork workflow), so a shared `release.toml` can't reliably name the push target. `push-remote` may now be a URL. It is resolved to the configured remote whose `url` or `pushurl` matches, ignoring scheme, user, port, a trailing `.git`, and host case, so https and ssh forms of the same repo match. If no remote matches, we error early and list the configured remotes; if several match, we error and name them. Values without a `:` are still treated as remote names, unchanged. Fixes crate-ci#1007
This branch has not been deployed
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.
Remote names differ between clones (e.g.
originvsupstreamin a fork workflow), so a sharedrelease.tomlcan't reliably name the push target.push-remotemay now be a URL. It is resolved to the configured remote whoseurlorpushurlmatches, ignoring scheme, user, port, a trailing.git, and host case, so https and ssh forms of the same repo match. If no remote matches, we error early and list the configured remotes; if several match, we error and name them. Values without a:are still treated as remote names, unchanged.Fixes #1007
What does this PR try to solve?
Closes #1007
The
push-remoteinreleas.tomlcurrently only accepts a remote name. As discussed in #1007 names differ between clones, so in a workflow one person'soriginorupstreammight not actually point to the git repo which the projects release is supposed to target. This PR letspush-remote(and--push-remote) accept a URL, the repository can be addressed in a universally unique way.The URL is must resolve to local git remote whose
urlorpushurlmatches it. So a remote listed ingit remote -vmust match the provided URL. Then everything after that works on that remote's name as before.In the related issue we discussed having git push to a URL, and detecting a URL vs remote name. By resolving the URL to a remote name, we don't need to worry about pushing to a URL. As for detecting URLs, we just check for
:in thepush-remotestring. This works because: git remotes cannot contain:and (I'm 99% sure) the URLs for git remotes always contain a:.Behavior:
There are a few cases to consider. The existing behavior: this happens whenever there is no
:inpush-remote. New behavior happens when there is a:and this has a few cases:git remote add:Resolution only happens when pushing is enabled, so
--no-pushis unaffected.Notes to reviewers
normalize_urlinsrc/ops/git.rs, written that way to avoid adding aurl/gix-urldependency. Local paths andfile://URLs aren't normalized and fall back to an exact string match.originandupstreamremotes, using the https and scp forms of the upstream URL, the nameupstream, and an unknown URL. There was no existing machinery in the tests for stuff like this so I did it manually.LLM stuff: I used Claude Code to understand the repo, plan approach, and to write the unit tests.