| @@ -25,11 +25,7 @@ impl<'repo> Snapshot<'repo> { · 24 unmodified lines |
| 25 | | 25 | |
| 26 | /// Like [`boolean()`][Self::boolean()], but it will report an error if the value couldn't be interpreted as boolean. | 26 | /// Like [`boolean()`][Self::boolean()], but it will report an error if the value couldn't be interpreted as boolean. |
| 27 | pub fn try_boolean<'a>(&self, key: impl Into<&'a BStr>) -> Option<Result<bool, git_config::value::Error>> { | 27 | pub fn try_boolean<'a>(&self, key: impl Into<&'a BStr>) -> Option<Result<bool, git_config::value::Error>> { |
| 28 | let key = git_config::parse::key(key)?; | 28 | self.repo.config.resolved.boolean_by_key(key) |
| 29 | self.repo | | |
| 30 | .config | | |
| 31 | .resolved | | |
| 32 | .boolean(key.section_name, key.subsection_name, key.value_name) | | |
| 33 | } | 29 | } |
| 34 | | 30 | |
| 35 | /// Return the resolved integer at `key`, or `None` if there is no such value or if the value can't be interpreted as | 31 | /// Return the resolved integer at `key`, or `None` if there is no such value or if the value can't be interpreted as |
| @@ -44,22 +40,14 @@ impl<'repo> Snapshot<'repo> { · 8 unmodified lines |
| 44 | | 40 | |
| 45 | /// Like [`integer()`][Self::integer()], but it will report an error if the value couldn't be interpreted as boolean. | 41 | /// Like [`integer()`][Self::integer()], but it will report an error if the value couldn't be interpreted as boolean. |
| 46 | pub fn try_integer<'a>(&self, key: impl Into<&'a BStr>) -> Option<Result<i64, git_config::value::Error>> { | 42 | pub fn try_integer<'a>(&self, key: impl Into<&'a BStr>) -> Option<Result<i64, git_config::value::Error>> { |
| 47 | let key = git_config::parse::key(key)?; | 43 | self.repo.config.resolved.integer_by_key(key) |
| 48 | self.repo | | |
| 49 | .config | | |
| 50 | .resolved | | |
| 51 | .integer(key.section_name, key.subsection_name, key.value_name) | | |
| 52 | } | 44 | } |
| 53 | | 45 | |
| 54 | /// Return the string at `key`, or `None` if there is no such value. | 46 | /// Return the string at `key`, or `None` if there is no such value. |
| 55 | /// | 47 | /// |
| 56 | /// Note that this method takes the most recent value at `key` even if it is from a file with reduced trust. | 48 | /// Note that this method takes the most recent value at `key` even if it is from a file with reduced trust. |
| 57 | pub fn string<'a>(&self, key: impl Into<&'a BStr>) -> Option<Cow<'_, BStr>> { | 49 | pub fn string<'a>(&self, key: impl Into<&'a BStr>) -> Option<Cow<'_, BStr>> { |
| 58 | let key = git_config::parse::key(key)?; | 50 | self.repo.config.resolved.string_by_key(key) |
| 59 | self.repo | | |
| 60 | .config | | |
| 61 | .resolved | | |
| 62 | .string(key.section_name, key.subsection_name, key.value_name) | | |
| 63 | } | 51 | } |
| 64 | | 52 | |
| 65 | /// Return the trusted and fully interpolated path at `key`, or `None` if there is no such value | 53 | /// Return the trusted and fully interpolated path at `key`, or `None` if there is no such value |