Unified · Split
| @@ -1,7 +1,6 @@ | |||
| 1 | use std::convert::TryFrom; | ||
| 1 | use std::{borrow::Cow, path::PathBuf}; | 2 | use std::{borrow::Cow, path::PathBuf}; |
| 2 | 3 | ||
| 3 | use bstr::BString; | ||
| 4 | |||
| 5 | use crate::{ | 4 | use crate::{ |
| 6 | file::{from_paths, init::resolve_includes}, | 5 | file::{from_paths, init::resolve_includes}, |
| 7 | parse::section, | 6 | parse::section, |
| @@ -27,6 +26,8 @@ pub enum Error { · 19 unmodified lines | |||
| 27 | FromPathsError(#[from] from_paths::Error), | 26 | FromPathsError(#[from] from_paths::Error), |
| 28 | #[error(transparent)] | 27 | #[error(transparent)] |
| 29 | Section(#[from] section::header::Error), | 28 | Section(#[from] section::header::Error), |
| 29 | #[error(transparent)] | ||
| 30 | Key(#[from] section::key::Error), | ||
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | /// Instantiation from environment variables | 33 | /// Instantiation from environment variables |
| @@ -112,8 +113,8 @@ impl File<'static> { · 79 unmodified lines | |||
| 112 | }; | 113 | }; |
| 113 | 114 | ||
| 114 | section.push( | 115 | section.push( |
| 115 | section::Key(BString::from(key).into()), | 116 | section::Key::try_from(key.to_owned())?, |
| 116 | git_path::into_bstr(PathBuf::from(value)).as_ref(), | 117 | git_path::os_str_into_bstr(&value).expect("no illformed UTF-8").as_ref(), |
| 117 | ); | 118 | ); |
| 118 | } | 119 | } |
| 119 | None => { | 120 | None => { |