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

Re: [PATCH v9r2 1/2] add `config_set` API for caching config-like files

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2014, 17:12 UTC
Message-ID
<xmqq1ttjrjt1.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqy4vsme4w.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 47 quoted lines
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Tanay Abhra <tanayabh@gmail.com> writes:
>>
>>> I have a question about renaming git_config() to git_config_raw().
>>> I was working on a patch and I am getting stuck here.
>>> It fails in t1001, t1020 & t4018. The reason for the last test failure
>>> is unknown right now. For the first two, it boils down to this,
>>>
>>> 		git init --bare bare-ancestor-aliased.git &&
>>> 		cd bare-ancestor-aliased.git &&
>>> 		echo "[alias] aliasedinit = init" >>config &&
>>> 		mkdir plain-nested &&
>>> 		cd plain-nested &&
>>> 		git aliasedinit
>>
>> Git tries to read .git/config relative to the current directory, and
>> tries to resolve aliases from it. The problem is: if one tries to do
>> this from a subdirectory inside the repo, .git/config is not the right
>> path, and the alias lookup fails.
>>
>> I'll investigate more later.
>
> This fixes the first two tests (it should be squashed into your PATCH 1
> regardless of the rename git_config -> git_config_raw):
>
> commit 42315d10e21a1273b73671a3f8c9f7640c4feb44 (HEAD, config-v9)
> Author: Matthieu Moy <Matthieu.Moy@imag.fr>
> Date:   Thu Jul 17 13:12:21 2014 +0200
>
>     clear the config cache in setup_git_dir
>
> diff --git a/setup.c b/setup.c
> index 0a22f8b..c0d31f5 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -625,6 +625,15 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
>         int one_filesystem = 1;
>  
>         /*
> +        * We may have read an incomplete configuration before
> +        * setting-up the git directory. If so, clear the cache so
> +        * that the next queries to the configuration reload complete
> +        * configuration (including the per-repo config file that we
> +        * ignored previously).
> +        */
> +       git_config_clear();
Very sensible.
> +       /*
>          * Let's assume that we are in a git repository.
>          * If it turns out later that we are somewhere else, the value will be
>          * updated accordingly.
Previous: Matthieu Moy
Message 26 of 26 in “git config cache & special querying api utilizing the cache”
  1. 0/3 git config cache & special querying api utilizing the cacheTanay Abhra, Jul 15, 2014
  2. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 15, 2014
  3. Junio C HamanoJul 15, 2014
  4. Tanay AbhraJul 15, 2014
  5. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 16, 2014
  6. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 15, 2014
  7. Junio C HamanoJul 15, 2014
  8. Tanay AbhraJul 15, 2014
  9. Junio C HamanoJul 15, 2014
  10. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 16, 2014
  11. Matthieu MoyJul 16, 2014
  12. 1/2 add `config_set` API for caching config-like filesTanay Abhra, Jul 16, 2014
  13. Matthieu MoyJul 16, 2014
  14. 1/3 fixup for patch 2: minor style fixMatthieu Moy, Jul 16, 2014
  15. 2/3 fixup for patch 2: actually check the return valueMatthieu Moy, Jul 16, 2014
  16. Tanay AbhraJul 16, 2014
  17. Matthieu MoyJul 16, 2014
  18. 3/3 fixup for patch 1: typoMatthieu Moy, Jul 16, 2014
  19. Tanay AbhraJul 16, 2014
  20. Matthieu MoyJul 16, 2014
  21. 2/2 test-config: add tests for the config_set APITanay Abhra, Jul 16, 2014
  22. Matthieu MoyJul 17, 2014
  23. Tanay AbhraJul 17, 2014
  24. Matthieu MoyJul 17, 2014
  25. Matthieu MoyJul 17, 2014
  26. Junio C HamanoJul 17, 2014

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.