Commit e145a0b
config: correct file reading order in read_early_config()
Config file reading order is important because each file can override
values in the previous files and this is expected behavior. Normally
we read in this order, all in do_git_config_sequence():
1. $HOME/.gitconfig
2. $GIT_DIR/config
3. config from command line
However in read_early_config() the order may be swapped a bit if
setup_git_directory() has not been called:
1. $HOME/.gitconfig
2. $GIT_DIR/config is NOT read because .git dir is not found _yet_
3. config from command line
4. $GIT_DIR/config is now READ (after discover_git_directory() call)
The reading at step 4 could override config at step 3, which is not
the expectation.
Now that we could pass the .git dir around, we could feed
discover_git_directory() back to step 2, so that it works again, and
remove step 4.
Noticed-by: Jeff King <peff@peff.net>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 2185fde commit e145a0b
2 files changed
Lines changed: 30 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
1507 | | - | |
| 1507 | + | |
| 1508 | + | |
1508 | 1509 | | |
1509 | 1510 | | |
1510 | 1511 | | |
1511 | 1512 | | |
1512 | | - | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
1513 | 1521 | | |
1514 | 1522 | | |
1515 | 1523 | | |
| |||
1563 | 1571 | | |
1564 | 1572 | | |
1565 | 1573 | | |
1566 | | - | |
| 1574 | + | |
1567 | 1575 | | |
1568 | 1576 | | |
1569 | 1577 | | |
| |||
1613 | 1621 | | |
1614 | 1622 | | |
1615 | 1623 | | |
1616 | | - | |
1617 | 1624 | | |
1618 | 1625 | | |
1619 | 1626 | | |
| |||
1628 | 1635 | | |
1629 | 1636 | | |
1630 | 1637 | | |
1631 | | - | |
| 1638 | + | |
1632 | 1639 | | |
1633 | 1640 | | |
1634 | 1641 | | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | 1642 | | |
1644 | | - | |
1645 | 1643 | | |
1646 | 1644 | | |
1647 | 1645 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
50 | 68 | | |
51 | 69 | | |
52 | 70 | | |
| |||
0 commit comments