Pie-in-the-sky attempt to fix the early config
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest7 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | Make read_early_config() reusablecache.h config.c pager.c | +32 | 0 replies | |
| 2/7 | read_early_config(): avoid .git/config hack when unneededconfig.c | +1 | 0 replies | |
| 3/7 | Mark builtins that create .git/ directoriesgit.c | +5 | 0 replies | |
| 4/7 | read_early_config(): special-case `init` and `clone`builtin/ builtin/ builtin/ +7 more | +31 | 0 replies | |
| 5/7 | read_early_config(): really discover .git/config.c | +49 | 0 replies | |
| 6/7 | WIP read_config_early(): respect ceiling directoriesconfig.c | +53 | 0 replies | |
| 7/7 | WIP: read_early_config(): add testst/ t/ | +65 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH/RFC 0/7] Pie-in-the-sky attempt to fix the early config
Hopefully these patches will lead to something that we can integrate, and that eventually will make Git's startup sequence much less surprising.
The idea here is to discover the .git/ directory gently (i.e. without changing the current working directory), and to use it to read the .git/config file early, before we actually called setup_git_directory() (if we ever do that).
Notes:
- I find the diff pretty ugly: I wish there was a more elegant way to *disable* discovery of .git/ *just* for init and clone. I considered a function about_to_create_git_dir() that is called in a hard-coded manner *only* for init and clone, but that would introduce another magic side effect, when all I want is to reduce those.
- For the moment, I do not handle dashed invocations of init and clone correctly. The real problem is the continued existence of the dashed git-init and git-clone, of course.
- There is still duplicated code. For the sake of this RFC, I did not address that yet.
- The read_early_config() function is called multiple times, re-reading all the config files and re-discovering the .git/ directory multiple times, which is quite wasteful. For the sake of this RFC, I did not address that yet.
- t7006 fails and the error message is a bit cryptic (not to mention the involved function trace, which is mind-boggling for what is supposed to be a simply, shell script-based test suite). I did not have time to look into that yet.
- after discover_git_directory_gently() did its work, the code happily uses its result *only* for the current read_early_config() run, and lets setup_git_dir_gently() do the whole work *again*. For the sake of this RFC, I did not address that yet.
Johannes Schindelin (7):
Make read_early_config() reusable read_early_config(): avoid .git/config hack when unneeded Mark builtins that create .git/ directories read_early_config(): special-case init and clone read_early_config(): really discover .git/
WIP read_config_early(): respect ceiling directories
WIP: read_early_config(): add tests
builtin/am.c | 2 +- builtin/blame.c | 2 +- builtin/grep.c | 4 +- builtin/log.c | 4 +- builtin/var.c | 2 +- cache.h | 8 ++-- config.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ diff.c | 4 +- git.c | 25 +++++------ pager.c | 44 +++---------------- t/helper/test-config.c | 15 +++++++ t/t1309-early-config.sh | 50 ++++++++++++++++++++++ 12 files changed, 209 insertions(+), 61 deletions(-) create mode 100755 t/t1309-early-config.sh
base-commit: 8d7a455ed52e2a96debc080dfc011b6bb00db5d2
Published-As: https://github.com/dscho/git/releases/tag/early-config-v1
Fetch-It-Via: git fetch https://github.com/dscho/git early-config-v1
Signature · 1 line
2.11.0.rc3.windows.1