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

Re: [PATCH v10 3/4] add `config_set` API for caching config-like files

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jul 18, 2014, 10:03 UTC
Message-ID
<912531111.2607532.1405677832726.JavaMail.zimbra@imag.fr>
In-Reply-To
<53C8EE71.5000703@gmail.com>
I think my proposal is a fix, and yours is a workaround. Semantically, calling setup_git_directory changes the config, so it should invalidate the cache. Your proposal consists in not filling-in the cache before it is invalidated, which works, but isn't very future-proof: if anybody fills-in the cache before the setup in the future, it will break it.
Now, both options can go together, then moving the check_pager_config call after setup_git_directory would avoid re-filling-in the cache. Intuitively, I'd say it's even needed in case git is started from a subdirectory and the .git/config contains pager-relevant stuff, but there might be complications.
----- Original Message -----
Show 43 quoted lines
> 
> 
> On 7/18/2014 3:10 PM, Matthieu Moy wrote:
> > ----- Original Message -----
> >>  Documentation/technical/api-config.txt | 137 +++++++++++++++++
> >>  cache.h                                |  30 ++++
> >>  config.c                               | 263
> >>  +++++++++++++++++++++++++++++++++
> >>  3 files changed, 430 insertions(+)
> > 
> > I think the added call to git_config_clear() I proposed yesterday in
> > setup_git_directory_gently_1 should be part of this patch (with the
> > associated comment), just like this call:
> >
> 
> Oh, my bad, I thought you meant that I incorporate it with the
> git_config_raw() patch.
> I wanted to ask, can we call setup_git_directory_gently() earlier in
> execv_dashed_external()
> in git.c, which calls check_pager_config() for the first time which causes
> the
> incomplete cache to formed.
> If we can do it, we won't have to clear the cache every time
> setup_git_directory_gently_1()
> is called.
> 
> >> @@ -1707,6 +1967,9 @@ int git_config_set_multivar_in_file(const char
> >> *config_filename,
> >>  	lock = NULL;
> >>  	ret = 0;
> >>  
> >> +	/* Invalidate the config cache */
> >> +	git_config_clear();
> >> +
> >>  out_free:
> >>  	if (lock)
> >>  		rollback_lock_file(lock);
> > 
> > I have limited access to my email and no way to apply the patches today, so
> > I can't do a detailed review. But other than the remark above, I guess the
> > patch series is now all right and ready to cook in pu.
> > 
> 
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Tanay AbhraNext: Tanay Abhra
Message 8 of 11 in “git config cache & special querying api utilizing the cache”
  1. 0/4 git config cache & special querying api utilizing the cacheTanay Abhra, Jul 18, 2014
  2. 1/4 string-list: add string_list initializer helper functionTanay Abhra, Jul 18, 2014
  3. Junio C HamanoJul 18, 2014
  4. 2/4 replace memset with string-list initializersTanay Abhra, Jul 18, 2014
  5. 3/4 add `config_set` API for caching config-like filesTanay Abhra, Jul 18, 2014
  6. Matthieu MoyJul 18, 2014
  7. Tanay AbhraJul 18, 2014
  8. Matthieu MoyJul 18, 2014
  9. 4/4 test-config: add tests for the config_set APITanay Abhra, Jul 18, 2014
  10. Junio C HamanoJul 18, 2014
  11. Matthieu MoyJul 18, 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.