Unified · Split
| @@ -432,7 +432,7 @@ impl<'event> GitConfig<'event> { · 431 unmodified lines | ||
| 432 | 432 | let mut paths = vec![]; |
| 433 | 433 | |
| 434 | 434 | if env::var("GIT_CONFIG_NO_SYSTEM").is_err() { |
| 435 | − if let Ok(git_config_system) = env::var("GIT_CONFIG_SYSTEM") { | |
| 435 | + if let Some(git_config_system) = env::var_os("GIT_CONFIG_SYSTEM") { | |
| 436 | 436 | paths.push(PathBuf::from(git_config_system)) |
| 437 | 437 | } else { |
| 438 | 438 | // In git the fallback is set to a build time macro which defaults to /etc/gitconfig |
| @@ -440,24 +440,24 @@ impl<'event> GitConfig<'event> { · 1 unmodified line | ||
| 440 | 440 | } |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | − if let Ok(git_config_global) = env::var("GIT_CONFIG_GLOBAL") { | |
| 443 | + if let Some(git_config_global) = env::var_os("GIT_CONFIG_GLOBAL") { | |
| 444 | 444 | paths.push(PathBuf::from(git_config_global)); |
| 445 | 445 | } else { |
| 446 | 446 | // Divergence from git-config(1) |
| 447 | 447 | // These two are supposed to share the same scope and override |
| 448 | 448 | // rather than append according to git-config(1) documentation. |
| 449 | − if let Ok(xdg_config_home) = env::var("XDG_CONFIG_HOME") { | |
| 449 | + if let Some(xdg_config_home) = env::var_os("XDG_CONFIG_HOME") { | |
| 450 | 450 | paths.push(PathBuf::from(xdg_config_home).join("git/config")); |
| 451 | − } else if let Ok(home) = env::var("HOME") { | |
| 451 | + } else if let Some(home) = env::var_os("HOME") { | |
| 452 | 452 | paths.push(PathBuf::from(home).join(".config/git/config")); |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | − if let Ok(home) = env::var("HOME") { | |
| 455 | + if let Some(home) = env::var_os("HOME") { | |
| 456 | 456 | paths.push(PathBuf::from(home).join(".gitconfig")); |
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | − if let Ok(git_dir) = env::var("GIT_DIR") { | |
| 460 | + if let Some(git_dir) = env::var_os("GIT_DIR") { | |
| 461 | 461 | paths.push(PathBuf::from(git_dir).join("config")); |
| 462 | 462 | } |
| 463 | 463 | |
| @@ -485,8 +485,8 @@ impl<'event> GitConfig<'event> { · 21 unmodified lines | ||
| 485 | 485 | for i in 0..count { |
| 486 | 486 | let key = |
| 487 | 487 | env::var(format!("GIT_CONFIG_KEY_{}", i)).map_err(|_| from_env::Error::InvalidKeyId { key_id: i })?; |
| 488 | − let value = env::var(format!("GIT_CONFIG_VALUE_{}", i)) | |
| 489 | − .map_err(|_| from_env::Error::InvalidValueId { value_id: i })?; | |
| 488 | + let value = env::var_os(format!("GIT_CONFIG_VALUE_{}", i)) | |
| 489 | + .ok_or_else(|| from_env::Error::InvalidValueId { value_id: i })?; | |
| 490 | 490 | if let Some((section_name, maybe_subsection)) = key.split_once('.') { |
| 491 | 491 | let (subsection, key) = if let Some((subsection, key)) = maybe_subsection.rsplit_once('.') { |
| 492 | 492 | (Some(subsection), key) |
| @@ -507,7 +507,7 @@ impl<'event> GitConfig<'event> { · 14 unmodified lines | ||
| 507 | 507 | |
| 508 | 508 | section.push( |
| 509 | 509 | Cow::<str>::Owned(key.to_string()).into(), |
| 510 | − Cow::Owned(value.into_bytes()), | |
| 510 | + Cow::Owned(git_path::into_bstr(PathBuf::from(value)).into_owned().into()), | |
| 511 | 511 | ); |
| 512 | 512 | } else { |
| 513 | 513 | return Err(from_env::Error::InvalidKeyValue { |