Subject: Re: [RFC/PATCH] pager.c: replace git_config with git_config_get_string

From: Matthieu Moy <[email-masked]>
Date: Sat, 28 Jun 2014 08:01:52 +0200

Karsten Blees <[email-masked]> writes:

> I still don't like that the invalidation is done in git_config_set, though, as
> this is also used to write completely unrelated files.

I don't get it. It is used to write the config files. Yes, we trigger a
complete reload instead of just changing this particular value in the
hashmap, but I do not see "unrelated files" in the picture.

> Wouldn't it be better to have a 'git_config_refresh()' that could be
> used in place of (or before) current 'git_config(callback)' calls? The
> initial implementation could just invalidate the config cache. If
> there's time and energy to spare, a more advanced version could first
> check if any of the involved config files has changed.

That would not change the "xstrdup" vs "no xstrdup" issue, right?

> The xstrdup() problem could be solved by interning strings (see the
> attached patch for a trivial implementation). I.e. allocate each distinct
> string only once (and keep it allocated).

That's an option. We need to be carefull not to modify any string
in-place, but I guess that would considerably simplify memory management
for strings.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/