git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Dennis Kaarsemaker <dennis@kaarsemaker.net>
To: Jeff King <peff@peff.net>, git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: Re: [PATCH 0/16] fix config-reading in non-repos
Date: Wed, 14 Sep 2016 12:55:41 +0200	[thread overview]
Message-ID: <1473850541.30531.18.camel@kaarsemaker.net> (raw)
In-Reply-To: <20160913032242.coyuhyhn6uklewuk@sigill.intra.peff.net>

On ma, 2016-09-12 at 23:22 -0400, Jeff King wrote:

> The motivation for this series is to fix the regression in v2.9 where
> core.logallrefupdates is sometimes not set properly in a newly
> initialized repository, as described in this thread:
> 
>   http://public-inbox.org/git/c46d36ef-3c2e-374f-0f2e-ffe31104e023@gmx.de/T/#u
> 
> The root of the problem is that we are overly eager to read and use
> config from ".git/config", even when we have not established that it is
> part of a repository. This is especially bad for git-init, which would
> not want to read anything until we've created the new repo.
> 
> So the two interesting parts of the fix are:
> 
>   1. We stop blindly reading ".git/config" when we don't know there's an
>      actual git directory. This is in patch 14, and is actually enough
>      to fix the v2.9 regression.
> 
>   2. We are more thorough about dropping any cached config values when
>      we move into the new repository in git-init (patch 16).
> 
>      I didn't dig into when this was broken, but it was probably when we
>      switched git_config() to use cached values in the v2.2.0
>      time-frame.
> 
> Doing (1) required fixing up some builtins that depended on the blind
> .git/config thing, as the tests demonstrated. But I think this is a sign
> that we are moving in the right direction, because each one of those
> programs could easily be demonstrated to be broken in scenarios only
> slightly more exotic than the test scripts (e.g., see patch 3 for one of
> the simplest cases).
> 
> So I think notwithstanding their use as prep for patch 14, patches 1-13
> fix useful bugs.
> 
> I won't be surprised if there are other fallouts that were not caught by
> the test suite (i.e., programs that expect to read config, don't do
> RUN_SETUP, but aren't covered well by tests). I poked around the list of
> builtins in git.c that do not use RUN_SETUP, and they seem to correctly
> end up in setup_git_directory_gently() before reading config. But it's
> possible I missed a case.
> 
> So this is definitely a bit larger than I'd hope for a regression-fix to
> maint. But anything that doesn't address this issue at the config layer
> is going to end up as a bit of a hack, and I'd rather not pile up hacks
> if we can avoid it.

Agreed with all of the above, this is much better than just fixing the
symptom on the mailinglist thread that started this.

> I've cc'd Dennis, who helped investigate solutions in the thread
> mentioned above, and Duy, because historically he has been the one most
> willing and able to battle the dragon of our setup code. :)
> 
>   [01/16]: t1007: factor out repeated setup
>   [02/16]: hash-object: always try to set up the git repository
>   [03/16]: patch-id: use RUN_SETUP_GENTLY
>   [04/16]: diff: skip implicit no-index check when given --no-index
>   [05/16]: diff: handle --no-index prefixes consistently
>   [06/16]: diff: always try to set up the repository
>   [07/16]: pager: remove obsolete comment
>   [08/16]: pager: stop loading git_default_config()
>   [09/16]: pager: make pager_program a file-local static
>   [10/16]: pager: use callbacks instead of configset
>   [11/16]: pager: handle early config
>   [12/16]: t1302: use "git -C"
>   [13/16]: test-config: setup git directory
>   [14/16]: config: only read .git/config from configured repos
>   [15/16]: init: expand comments explaining config trickery
>   [16/16]: init: reset cached config when entering new repo

Couldn't find anything to comment on, and I've tested that this does
indeed fix the symptoms we saw.

Reviewed-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>

-- 
Dennis Kaarsemaker
http://www.kaarsemaker.net


  parent reply	other threads:[~2016-09-14 10:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13  3:22 [PATCH 0/16] fix config-reading in non-repos Jeff King
2016-09-13  3:23 ` [PATCH 01/16] t1007: factor out repeated setup Jeff King
2016-09-13 21:42   ` Stefan Beller
2016-09-13  3:23 ` [PATCH 02/16] hash-object: always try to set up the git repository Jeff King
2016-09-13  3:23 ` [PATCH 03/16] patch-id: use RUN_SETUP_GENTLY Jeff King
2016-09-13  3:23 ` [PATCH 04/16] diff: skip implicit no-index check when given --no-index Jeff King
2016-09-13  3:23 ` [PATCH 05/16] diff: handle --no-index prefixes consistently Jeff King
2016-09-13  3:23 ` [PATCH 06/16] diff: always try to set up the repository Jeff King
2016-09-13 22:00   ` Stefan Beller
2016-09-13 22:22     ` Jeff King
2016-09-13  3:23 ` [PATCH 07/16] pager: remove obsolete comment Jeff King
2016-09-13  3:23 ` [PATCH 08/16] pager: stop loading git_default_config() Jeff King
2016-09-13  3:23 ` [PATCH 09/16] pager: make pager_program a file-local static Jeff King
2016-09-13  3:23 ` [PATCH 10/16] pager: use callbacks instead of configset Jeff King
2016-09-13  3:23 ` [PATCH 11/16] pager: handle early config Jeff King
2016-09-13  3:24 ` [PATCH 12/16] t1302: use "git -C" Jeff King
2016-09-13  3:24 ` [PATCH 13/16] test-config: setup git directory Jeff King
2016-09-13  3:24 ` [PATCH 14/16] config: only read .git/config from configured repos Jeff King
2016-09-13  3:24 ` [PATCH 15/16] init: expand comments explaining config trickery Jeff King
2016-09-13  3:24 ` [PATCH 16/16] init: reset cached config when entering new repo Jeff King
2016-09-13 22:18   ` Stefan Beller
2016-09-14 10:55 ` Dennis Kaarsemaker [this message]
2016-09-14 15:31   ` [PATCH 0/16] fix config-reading in non-repos Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1473850541.30531.18.camel@kaarsemaker.net \
    --to=dennis@kaarsemaker.net \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).