Commit f141ee7
config: keep bailing on unreadable global files
The expected 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, config: read global scope via config_sequence,
introduced a regression in scenario B. When both global config files are
unreadable, running `git config list --global` would not fail. For
example, `GIT_CONFIG_GLOBAL=does-not-exist git config list --global`
exits 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 config files are unreadable,
then adjust the return code to be non-zero.
Note: When bailing, the exit code is not determined by sum of the return
codes of the underlying operations. Instead, the exit code is modified
via a single decrement. If this is undesirable, we can change it to sum
the return codes of the underlying operations instead.
Lastly, modify the tests to remove the known breakage/regression. The
tests for scenario B will now pass.
Helped-by: Derrick Stolee <[email protected]>
Signed-off-by: Delilah Ashley Wu <[email protected]>
Reviewed-by: Johannes Schindelin <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>1 parent eb3a952 commit f141ee7
2 files changed
+33
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1512 | 1512 | | |
1513 | 1513 | | |
1514 | 1514 | | |
1515 | | - | |
1516 | | - | |
| 1515 | + | |
| 1516 | + | |
1517 | 1517 | | |
1518 | 1518 | | |
1519 | 1519 | | |
| |||
1546 | 1546 | | |
1547 | 1547 | | |
1548 | 1548 | | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
1549 | 1552 | | |
1550 | 1553 | | |
1551 | | - | |
1552 | | - | |
1553 | | - | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
1554 | 1573 | | |
1555 | | - | |
1556 | | - | |
1557 | | - | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
1558 | 1577 | | |
1559 | 1578 | | |
1560 | 1579 | | |
| |||
1615 | 1634 | | |
1616 | 1635 | | |
1617 | 1636 | | |
1618 | | - | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
1619 | 1641 | | |
1620 | 1642 | | |
1621 | 1643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2367 | 2367 | | |
2368 | 2368 | | |
2369 | 2369 | | |
2370 | | - | |
| 2370 | + | |
2371 | 2371 | | |
2372 | 2372 | | |
2373 | 2373 | | |
| |||
2478 | 2478 | | |
2479 | 2479 | | |
2480 | 2480 | | |
2481 | | - | |
| 2481 | + | |
2482 | 2482 | | |
2483 | 2483 | | |
2484 | 2484 | | |
| |||
0 commit comments