History

doc: Actively discourage using `Boolean::try_from("")` explicitly.

Use `config.boolean(…)` instead.

Sebastian Thiel committed 3 years ago

Commit 4ebe2ac1 parent 62cae0e1 file · +9 −0Browse files

Unified · Split

git-config-value/src/boolean.rs+9−0
@@ -21,6 +21,15 @@ impl TryFrom<OsString> for Boolean { · 20 unmodified lines
21 }21 }
22}22}
23 23
24/// # Warning
25///
26/// The direct usage of `try_from("string")` is discouraged as it will produce the wrong result for values
27/// obtained from `core.bool-implicit-true`, which have no separator and are implicitly true.
28/// This method chooses to work correctly for `core.bool-empty=`, which is an empty string and resolves
29/// to being `false`.
30///
31/// Instead of this, obtain booleans with `config.boolean(…)`, which handles the case were no separator is
32/// present correctly.
24impl TryFrom<&BStr> for Boolean {33impl TryFrom<&BStr> for Boolean {
25 type Error = Error;34 type Error = Error;
26 35