Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit333896b

Browse files
committed
Treat false-seeming HIDE_* env var values as false
This changes how HIDE_WINDOWS_KNOWN_ERRORS andHIDE_WINDOWS_FREEZE_ERRORS environment variables, if present, areinterpreted, so that values that strongly seem intuitivley torepresent falsehood now do.Before, only the empty string was treated as false. Now:- "0", "false", "no", and their case variants, as well as the empty string, are treated as false.- The presence of leading and trailing whitespace in the value now longer changes the truth value it represents. For example, all-whitespace (e.g., a space) is treated as false.- Values other than the above false values, and the recognized true values "1", "true", "yes", and their variants, are still treated as true, but issue a warning about how they are unrecognied.
1 parenteb51277 commit333896b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

‎git/util.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,14 @@ def _read_env_flag(name: str, default: bool) -> bool:
121121
name,
122122
)
123123

124-
# FIXME: This should treat some values besides "" as expressing falsehood.
125-
returnbool(value)
124+
adjusted_value=value.strip().lower()
125+
126+
ifadjusted_valuein {"","0","false","no"}:
127+
returnFalse
128+
ifadjusted_valuein {"1","true","yes"}:
129+
returnTrue
130+
log.warning("%s has unrecognized value %r, treating as %r.",name,value,default)
131+
returndefault
126132

127133

128134
#: We need an easy way to see if Appveyor TCs start failing,

‎test/test_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,15 +529,15 @@ def run_parse(value):
529529
("true-seeming","True"),
530530
("true-seeming","yes"),
531531
("true-seeming","YES"),
532+
]
533+
falsy_cases= [
534+
("empty",""),
535+
("whitespace"," "),
532536
("false-seeming","0"),
533537
("false-seeming","false"),
534538
("false-seeming","False"),
535539
("false-seeming","no"),
536540
("false-seeming","NO"),
537-
("whitespace"," "),
538-
]
539-
falsy_cases= [
540-
("empty",""),
541541
]
542542

543543
formsg,env_var_valueintruthy_cases:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp