fix: preserve multiple remote URLs#2698
Draft
Sebastian Thiel (Byron) wants to merge 1 commit into
Draft
Conversation
1669ee1 to
432f8da
Compare
Configured remotes can have multiple remote.<name>.url or remote.<name>.pushUrl values, but gix::Remote kept only one value because lookup used the singular config accessor. That meant the most recent config value won, while Git exposes every effective URL and uses the first one for the singular get-url form. Add ordered URL storage to gix::Remote and expose Remote::urls(Direction) for all effective URLs. Keep Remote::url(Direction) as the singular compatibility API, now returning the first effective URL. Fetch URLs used as push fallbacks try pushInsteadOf first and then insteadOf, matching Git behavior. The regression fixture records Git 2.50.1 behavior with git remote get-url: without --all it prints the first configured URL, and with --all it prints all configured URLs in order for both fetch and push. Validation: - cargo test -p gix --test gix repository::remote::find_remote::multiple_urls_are_preserved_in_order_and_single_url_matches_git_first_url - cargo test -p gix --test gix repository::remote - cargo test -p gix --test gix remote:: - cargo test -p gix --test gix - cargo check -p gix --all-targets - cargo check -p gix --no-default-features --all-targets
432f8da to
2d25f4e
Compare
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by Codex GPT-5.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Fixes #2696
Summary
remote.<name>.urlandremote.<name>.pushUrlvalues ingix::Remoteinstead of collapsing to the most recent config value.Remote::urls(Direction)for all effective URLs, while keepingRemote::url(Direction)as the singular API returning the first effective URL.Git Baseline
Git 2.50.1 returns the first configured URL for
git remote get-url origin, whilegit remote get-url --all originreturns all URLs in configuration order. The same first/all behavior applies for--push. For fetch URLs used as push fallbacks, Git applies matchingpushInsteadOfrules before falling back toinsteadOf; explicitpushUrlvalues use normalinsteadOfrewrites.Validation
GIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix remote::save::save_as_to::inherited_urls_are_saved_with_reset_markers -- --exactGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix remote::saveGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gix repository::remoteGIX_TEST_IGNORE_ARCHIVES=1 cargo test -p gix --test gixcargo clippy -p gix --all-targets -- -D warningscargo check -p gix --all-targetscargo check -p gix --no-default-features --all-targets(passes with existinghex_to_id_sha1_onlydead-code warning)git diff --checkcodex review --commit 2d25f4e44b7b42a52469f75d39c39f109fbbfe01(no findings)2d25f4e44b7b42a52469f75d39c39f109fbbfe01.