git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCHv2] Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config
@ 2012-06-01 19:49 nguyenhu
  2012-06-04 17:27 ` Ramsay Jones
  0 siblings, 1 reply; 6+ messages in thread
From: nguyenhu @ 2012-06-01 19:49 UTC (permalink / raw)
  To: ramsay; +Cc: git

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:
> I have not tried this patch (or the v3 version, which I haven't read  
> yet), but
> is it likely that this has re-introduced the bug addressed by commit 05bab3ea
> ("config.c: Fix a static buffer overwrite bug by avoiding mkpath()",  
> >19-11-2011)?.
>
> I don't know the answer, but I suspect that it may have done just  
> that. >(indeed, it
> may well have made the bug more likely to appear).
>
>
>> The original that read from $HOME/.gitconfig was simple enough so
>> having three copies of getenv("HOME") was perfectly fine, but as you
>> are introduce this much complexity to to decide which two files to
>> read from, the code added this patch needs to be refactored and
>> three copies of the same logic need to be consolidated, I would have
>> to say.
>
> I agree. Also, using mksnpath() in the refactored code (rather than
> mkpath()) would be a good idea. :-P
>
> ATB,
> Ramsay Jones

Is not mkpath() the same function as mksnpath with char *buff =  
buf[PATH_MAX] and size_t n = sizeof(buf) ?

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCHv2] Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config
@ 2012-05-31  8:46 nguyenhu
  0 siblings, 0 replies; 6+ messages in thread
From: nguyenhu @ 2012-05-31  8:46 UTC (permalink / raw)
  To: Junio C Hamano, Matthieu Moy
  Cc: git, Lucien KONG, Valentin DUPERRAY, Thomas NGUY, Franck JONAS


Junio C Hamano <gitster@pobox.com> wrote:
> Is it just me who finds the above three lines extremely unreadable?
>
> Also can you give this patch a bit more sensible title?
> "Possibility to" does not tell us much---anything is possible if you
> change code after all.
>
> I see the patch does not touch the writing codepath, which is
> probably a good thing, but the log message should explicitly state
> that.

I will change that in my next version.

> I am not sure in what way $HOME/.gitconfig has "priority".
>
> Your proposed log message says that You read from $HOME/.gitconfig
> and then from $XDG_CONFIG_HOME/git/config, which means that any
> single-valued variable set in $HOME/.gitconfig will be overwritten
> by whatever is in $XDG_CONFIG_HOME/git/config, no?  That sounds like
> you are giving priority to the latter to me.

You are right. Git takes into account $HOME/.gitconfig if one variable  
is defined in both configuration files. I will explains that more  
clearly in documentation.

> The original that read from $HOME/.gitconfig was simple enough so
> having three copies of getenv("HOME") was perfectly fine, but as you
> are introduce this much complexity to to decide which two files to
> read from, the code added this patch needs to be refactored and
> three copies of the same logic need to be consolidated, I would have
> to say.

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> Shouldn't there be a helper function to get the path ~/.config/git/
> and then append config? You're already computing this path twice, and
> we'll need more instances of it if we want to give default values to
> core.excludesfile and core.attributesfile in this directory too.

I agree. I will write a function to get ~/.config/git/ and refactor code.

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <1338400509-26087-1-git-send-email-Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>]

end of thread, other threads:[~2012-06-04 17:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-01 19:49 [PATCHv2] Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config nguyenhu
2012-06-04 17:27 ` Ramsay Jones
  -- strict thread matches above, loose matches on Subject: below --
2012-05-31  8:46 nguyenhu
     [not found] <1338400509-26087-1-git-send-email-Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
2012-05-30 21:19 ` Huynh Khoi Nguyen NGUYEN
2012-05-30 21:54   ` Junio C Hamano
2012-05-31 22:06     ` Ramsay Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).