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

Showing the changes to git-config-value (1 of 1 file). Show all

Unified · Split

git-config-value/src/boolean.rs+9−0
@@ -21,6 +21,15 @@ impl TryFrom<OsString> for Boolean { · 20 unmodified lines
2121 }
2222 }
2323
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.
2433 impl TryFrom<&BStr> for Boolean {
2534 type Error = Error;
2635

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t