Skip to content

Pie-in-the-sky attempt to fix the early config

Johannes Schindelin git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7Make read_early_config() reusablecache.h config.c pager.c+32 -310 replies
2/7read_early_config(): avoid .git/config hack when unneededconfig.c+1 -10 replies
3/7Mark builtins that create .git/ directoriesgit.c+5 -40 replies
4/7read_early_config(): special-case `init` and `clone`builtin/am.c builtin/blame.c builtin/grep.c +7 more+31 -290 replies
5/7read_early_config(): really discover .git/config.c+49 -200 replies
6/7WIP read_config_early(): respect ceiling directoriesconfig.c+53 -30 replies
7/7WIP: read_early_config(): add testst/helper/test-config.c t/t1309-early-config.sh+65 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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