On Fri, Mar 03, 2017 at 03:03:56AM +0100, Johannes Schindelin wrote: > These patches are an attempt to make Git's startup sequence a bit less > surprising. > > The idea here is to discover the .git/ directory gently (i.e. without > changing the current working directory, or global variables), and to use > it to read the .git/config file early, before we actually called > setup_git_directory() (if we ever do that). Thanks for working on this. I think it's a huge improvement over the status quo, and over the earlier attempt. I don't see anything hugely wrong with this series, though I did note one bug, along with some minor refinements. > My dirty little secret is that I actually need this for something else > entirely. I need to patch an internal version of Git to gather > statistics, and to that end I need to read the config before and after > running every Git command. Hence the need for a gentle, and correct > early config. We do something similar at GitHub, but it falls into two categories: - stat-gathering that's on all the time, so doesn't need to look at config (I'm not sure in your case if you want to trigger the gathering with config, or if config is just one of the things you are gathering). - logging that is turned on selectively for some repos, but which doesn't have to be looked up until we know we are in a repo I looked into making something upstream-able, and my approach was to allow GIT_TRACE_* variables to be specified in the config. But of course that ran into the early-config problem (and I really wanted repo-level config there, because I'd like to be able to turn on tracing for just a single problematic repo). So not really something you need to work on, but maybe food for thought as you work on your internal project. -Peff