pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/libgit2/libgit2/pull/7195

/assets/global-0bd78641c0a1f3e0.css" /> fix: apply insteadOf from global config for detached remotes by weihanglo · Pull Request #7195 · libgit2/libgit2 · GitHub
Skip to content

fix: apply insteadOf from global config for detached remotes#7195

Open
weihanglo wants to merge 2 commits intolibgit2:mainfrom
weihanglo:insteadof
Open

fix: apply insteadOf from global config for detached remotes#7195
weihanglo wants to merge 2 commits intolibgit2:mainfrom
weihanglo:insteadof

Conversation

@weihanglo
Copy link
Copy Markdown
Contributor

@weihanglo weihanglo commented Jan 14, 2026

Detached remotes already read global/system config for http proxy
settings, but did not apply url.*.insteadOf or url.*.pushInsteadOf
rules. This inconsistency meant that git_remote_create_detached
behaved differently from git's ls-remote, which was the primary
use case for detached remotes.

This fixes it by loading the default config when no repository is
provided and apply insteadOf rules consistently.

While this is a behavior change, it still respects
GIT_REMOTE_CREATE_SKIP_INSTEADOF, meaning that user can restore
the previous behavior with minimal effort

Fixes #5469

How to review

Best review commit by commit.

The first commit shows the current behavior.
The test diff in the second commit demonstrates the behavior change.


This was found during the Cargo integration with SHA256.

I was trying detached remote to probe the remote object format first (via git_remote_oid_type exposed by #7185), and then set up the repository. Cargo needs to probe first because it stores sha256/sha1 separately for backward compatibility. However detached remote not respecting insteadOf may lead to inconsistent behavior.

`git_remote_create_detached` does not apply
`url.*.insteadOf` or url.*.pushInsteadOf from global config.

These tests currently pass, asserting the buggy behavior
and serving as a minimal reproduction.

The assertions will be updated when the fix is applied.

See <libgit2#5469>
Detached remotes already read global/system config for http proxy
settings, but did not apply url.*.insteadOf or url.*.pushInsteadOf
rules. This inconsistency meant that `git_remote_create_detached`
behaved differently from git's `ls-remote`, which was the primary
use case for detached remotes.

This fixes it by loading the default config when no repository is
provided and apply insteadOf rules consistently.

While this is a behavior change, it still respects
`GIT_REMOTE_CREATE_SKIP_INSTEADOF`, meaning that user can restore
the previous behavior with minimal effort

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git_remote_create_detached will not apply the insteadOf from global config

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy