git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] check_repository_format_version(): run git_default_config() again

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 6, 2007, 20:26 UTC
Message-ID
<7vsl6wbe9e.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<7vbqdkcxy3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> Sorry, I do not understand this patch from the commit log
> description.
>
> In the old days in 1.5.2 before either implementation of
> work-tree stuff, this function never called git_default_config()
> and presumably "git log" worked as expected for Brian.  Why is
> this call needed _here_, not in some of the callers?
Sorry scratch that.  v1.5.2 did not even have core.pager.

I see git_config(git_default_config) is called from setup_git_directory_gently() in the version that introduced core.pager. Curiously enough it does the config twice, once where no GIT_DIR is set and it sets inside_work_tree, and another by calling git_config(git_setup_config) -- big thanks for sorting this mess out.

I however have a mild suspicion that this has to be done much earlier.

For example, "git -p log" would first call handle_options(), which calls the setup_pager() logic, and then we call handle_internal_command() which calls setup_git_directory() that eventually leads to the callchain of finding the .git directory and .git/config file to be used. In that case, when we make the call to setup_pager() from handle_options(), we haven't even figured out if there is a configuration file, let alone reading from it.

We could work this around by having the "we need config -- where is it" logic in setup_pager(), but if we later have new options like -p that affects the way how git wrapper itself behaves based on the configuration, we would need the same "early config read" logic to support it.

Previous: Johannes SchindelinNext: Junio C Hamano
Message 3 of 5 in “core.pager handling broken”
  1. Brian GernhardtAug 6, 2007
  2. check_repository_format_version(): run git_default_config() againJohannes Schindelin, Aug 6, 2007
  3. Junio C HamanoAug 6, 2007
  4. Junio C HamanoAug 6, 2007
  5. Johannes SchindelinAug 6, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.