Commit 3f97f81
committed
config: keep bailing on unreadable global files
The behaviour for `git config list` is:
A. Without `--global`, it should not bail on unreadable/non-existent
global config files.
B. With `--global`, it should bail when both `$HOME/.gitconfig` and
`$XDG_CONFIG_HOME/git/config` are unreadable. It should not bail
when one or more of them is readable.
The previous patch introduced a regression in scenario B: running
`git config list --global` would not fail when both global config files
are unreadable. For example,
`GIT_CONFIG_GLOBAL=does-not-exist git config list --global` would exit
with status code 0.
Assuming that `config_source->scope == CONFIG_SCOPE_GLOBAL` iff the
`--global` argument is specified, use this to determine whether to bail.
When reading only the global scope and both global config files are
unreadable, then adjust the return code to be non-zero.
Note: The logic to determine the exit code does not actually sum the
return codes of the underlying operations. Instead, it uses a single
decrement operation. If this is undesirable, we can change it to sum
the return codes of the underlying operations instead.
Signed-off-by: Delilah Ashley Wu <delilahwu@microsoft.com>1 parent 1949f49 commit 3f97f81
1 file changed
+30
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2014 | 2014 | | |
2015 | 2015 | | |
2016 | 2016 | | |
2017 | | - | |
2018 | | - | |
| 2017 | + | |
| 2018 | + | |
2019 | 2019 | | |
2020 | 2020 | | |
2021 | 2021 | | |
| 2022 | + | |
| 2023 | + | |
2022 | 2024 | | |
2023 | 2025 | | |
2024 | 2026 | | |
| |||
2050 | 2052 | | |
2051 | 2053 | | |
2052 | 2054 | | |
2053 | | - | |
2054 | | - | |
2055 | | - | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
2056 | 2074 | | |
2057 | | - | |
2058 | | - | |
2059 | | - | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
2060 | 2078 | | |
2061 | 2079 | | |
2062 | 2080 | | |
| |||
2117 | 2135 | | |
2118 | 2136 | | |
2119 | 2137 | | |
2120 | | - | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
2121 | 2142 | | |
2122 | 2143 | | |
2123 | 2144 | | |
| |||
0 commit comments