summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-08-20 17:50:49 -0700
committerDan Davison <dandavison7@gmail.com>2021-08-20 19:58:07 -0700
commit3722146a25af54edd20c56c45aab6ac415ec75eb (patch)
tree2817034b04c356e69a4098ab9dae867b2ea33f2b
parent98485fcfec8edff271dd5df5413f6809cc003825 (diff)
Revert "Support `insteadOf` replacements in git remote URLs"
-rw-r--r--src/options/set.rs21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/options/set.rs b/src/options/set.rs
index c80be822..4fc0a1fd 100644
--- a/src/options/set.rs
+++ b/src/options/set.rs
@@ -574,13 +574,8 @@ fn set_git_config_entries(opt: &mut cli::Opt, git_config: &mut GitConfig) {
// Strings
for key in &["remote.origin.url"] {
- // We use libgit2 Repository::find_remote() instead of using the value
- // of remote.origin.url directly, in order that "insteadOf" replacements
- // are honored.
- // See https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf
- // and #693
- if let Some(url) = get_remote_url(git_config) {
- if let Ok(repo) = GitRemoteRepo::from_str(&url) {
+ if let Some(string) = git_config.get::<String>(key) {
+ if let Ok(repo) = GitRemoteRepo::from_str(&string) {
opt.git_config_entries
.insert(key.to_string(), GitConfigEntry::GitRemote(repo));
}
@@ -597,18 +592,6 @@ fn set_git_config_entries(opt: &mut cli::Opt, git_config: &mut GitConfig) {
}
}
-fn get_remote_url(git_config: &GitConfig) -> Option<String> {
- Some(
- git_config
- .repo
- .as_ref()?
- .find_remote("origin")
- .ok()?
- .url()?
- .to_owned(),
- )
-}
-
#[cfg(test)]
pub mod tests {
use std::fs::remove_file;