git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Josh Sharpe <josh.m.sharpe@gmail.com>,
	git@vger.kernel.org
Subject: Re: feature request - have git honor nested .gitconfig files
Date: Sat, 23 Mar 2013 04:06:38 -0400	[thread overview]
Message-ID: <20130323080638.GB29768@sigill.intra.peff.net> (raw)
In-Reply-To: <878v5ezlo1.fsf@pctrast.inf.ethz.ch>

On Sat, Mar 23, 2013 at 07:15:42AM +0100, Thomas Rast wrote:

> > It involves a shell invocation, but it's not like we parse config in a
> > tight loop. Bonus points if git provides the name of the current config
> > file, so exec can use relative paths like:
> 
> We do, however, parse config more than once:
> 
>   $ strace git log -1 2>&1 | grep 'open.*config'
>   open("/home/thomas/.gitconfig", O_RDONLY) = 3
>   open(".git/config", O_RDONLY)           = 3
>   open("/home/thomas/.gitconfig", O_RDONLY) = 3
>   open(".git/config", O_RDONLY)           = 3
>   open("/home/thomas/.gitconfig", O_RDONLY) = 3
>   open(".git/config", O_RDONLY)           = 3
>   open("/home/thomas/.gitconfig", O_RDONLY) = 3
>   open(".git/config", O_RDONLY)           = 3
> 
> git-log might be somewhat of an extreme example, but I suspect it's at
> least twice for all commands (once for repo detection and once for
> actual parsing).  So I further suspect that the slowdown in git's own
> shellscripts (rebase) would be quite large if you actually spawned two
> extra shells every time someone says 'git rev-parse ...'.

Yeah, I knew we parsed multiple times in some cases, but I don't think
it's that big a deal for a single command. But yeah, it might be
noticeable for a shell script which runs lots of git commands. Still, it
would only affect people who used the feature. And there is no reason
the config system could not learn to cache the results across a single
invocation, which would at least drop it to one shell per git command.

-Peff

      reply	other threads:[~2013-03-23  8:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-22 16:50 feature request - have git honor nested .gitconfig files Josh Sharpe
2013-03-22 18:22 ` Jonathan Nieder
2013-03-22 18:33   ` Jeff King
2013-03-23  0:06     ` Jonathan Nieder
2013-03-23  8:03       ` Jeff King
2013-03-24  7:14         ` Junio C Hamano
2013-03-23  6:15     ` Thomas Rast
2013-03-23  8:06       ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130323080638.GB29768@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=josh.m.sharpe@gmail.com \
    --cc=jrnieder@gmail.com \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).