| 1673 | } |
| 1674 | |
| 1675 | void read_early_config(struct repository *repo, config_fn_t cb, void *data) |
| 1676 | { |
| 1677 | struct config_options opts = {0}; |
| 1678 | struct strbuf commondir = STRBUF_INIT; |
| 1679 | struct strbuf gitdir = STRBUF_INIT; |
| 1680 | |
| 1681 | opts.respect_includes = 1; |
| 1682 | |
| 1683 | if (repo && repo->gitdir) { |
| 1684 | opts.commondir = repo_get_common_dir(repo); |
| 1685 | opts.git_dir = repo_get_git_dir(repo); |
| 1686 | /* |
| 1687 | * When setup_git_directory() was not yet asked to discover the |
| 1688 | * GIT_DIR, we ask discover_git_directory() to figure out whether there |
| 1689 | * is any repository config we should use (but unlike |
| 1690 | * setup_git_directory_gently(), no global state is changed, most |
| 1691 | * notably, the current working directory is still the same after the |
| 1692 | * call). |
| 1693 | */ |
| 1694 | } else if (!discover_git_directory(&commondir, &gitdir)) { |
| 1695 | opts.commondir = commondir.buf; |
| 1696 | opts.git_dir = gitdir.buf; |
| 1697 | } |
| 1698 | |
| 1699 | config_with_options(cb, data, NULL, NULL, &opts); |
| 1700 | |
| 1701 | strbuf_release(&commondir); |
| 1702 | strbuf_release(&gitdir); |
| 1703 | } |
| 1704 | |
| 1705 | void read_very_early_config(config_fn_t cb, void *data) |
| 1706 | { |