public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Tanay Abhra <tanayabh@gmail•com>
Cc: Junio C Hamano <gitster@pobox•com>,
	git@vger•kernel.org, Ramkumar Ramachandra <artagnon@gmail•com>
Subject: Re: [PATCH v9r2 1/2] add `config_set` API for caching config-like files
Date: Thu, 17 Jul 2014 13:13:51 +0200	[thread overview]
Message-ID: <vpqy4vsme4w.fsf@anie.imag.fr> (raw)
In-Reply-To: <vpqvbqwpalt.fsf@anie.imag.fr> (Matthieu Moy's message of "Thu, 17 Jul 2014 12:01:50 +0200")

Matthieu Moy <Matthieu.Moy@grenoble-inp•fr> writes:

> Tanay Abhra <tanayabh@gmail•com> writes:
>
>> I have a question about renaming git_config() to git_config_raw().
>> I was working on a patch and I am getting stuck here.
>> It fails in t1001, t1020 & t4018. The reason for the last test failure
>> is unknown right now. For the first two, it boils down to this,
>>
>> 		git init --bare bare-ancestor-aliased.git &&
>> 		cd bare-ancestor-aliased.git &&
>> 		echo "[alias] aliasedinit = init" >>config &&
>> 		mkdir plain-nested &&
>> 		cd plain-nested &&
>> 		git aliasedinit
>
> Git tries to read .git/config relative to the current directory, and
> tries to resolve aliases from it. The problem is: if one tries to do
> this from a subdirectory inside the repo, .git/config is not the right
> path, and the alias lookup fails.
>
> I'll investigate more later.

This fixes the first two tests (it should be squashed into your PATCH 1
regardless of the rename git_config -> git_config_raw):

commit 42315d10e21a1273b73671a3f8c9f7640c4feb44 (HEAD, config-v9)
Author: Matthieu Moy <Matthieu.Moy@imag•fr>
Date:   Thu Jul 17 13:12:21 2014 +0200

    clear the config cache in setup_git_dir

diff --git a/setup.c b/setup.c
index 0a22f8b..c0d31f5 100644
--- a/setup.c
+++ b/setup.c
@@ -625,6 +625,15 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
        int one_filesystem = 1;
 
        /*
+        * We may have read an incomplete configuration before
+        * setting-up the git directory. If so, clear the cache so
+        * that the next queries to the configuration reload complete
+        * configuration (including the per-repo config file that we
+        * ignored previously).
+        */
+       git_config_clear();
+
+       /*
         * Let's assume that we are in a git repository.
         * If it turns out later that we are somewhere else, the value will be
         * updated accordingly.

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

  parent reply	other threads:[~2014-07-17 11:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 14:29 [PATCH v9 0/3] git config cache & special querying api utilizing the cache Tanay Abhra
2014-07-15 14:29 ` [PATCH v9 1/2] add `config_set` API for caching config-like files Tanay Abhra
2014-07-15 15:46   ` Junio C Hamano
2014-07-15 16:22     ` Tanay Abhra
2014-07-16 11:41     ` [PATCH v9r1 " Tanay Abhra
2014-07-15 14:29 ` [PATCH v9 2/2] test-config: add tests for the config_set API Tanay Abhra
2014-07-15 15:57   ` Junio C Hamano
2014-07-15 17:07     ` Tanay Abhra
2014-07-15 18:26       ` Junio C Hamano
2014-07-16 11:44     ` [PATCH v9r1 " Tanay Abhra
2014-07-16 11:49       ` Matthieu Moy
2014-07-16 12:22         ` [PATCH v9r2 1/2] add `config_set` API for caching config-like files Tanay Abhra
2014-07-16 16:06           ` Matthieu Moy
2014-07-16 16:09             ` [PATCH 1/3] fixup for patch 2: minor style fix Matthieu Moy
2014-07-16 16:09               ` [PATCH 2/3] fixup for patch 2: actually check the return value Matthieu Moy
2014-07-16 16:55                 ` Tanay Abhra
2014-07-16 17:10                   ` Matthieu Moy
2014-07-16 16:09               ` [PATCH 3/3] fixup for patch 1: typo Matthieu Moy
2014-07-16 16:44             ` [PATCH v9r2 1/2] add `config_set` API for caching config-like files Tanay Abhra
2014-07-16 17:06               ` Matthieu Moy
     [not found]                 ` <53C6C2BD.3030703@gmail.com>
2014-07-17 10:01                   ` Matthieu Moy
2014-07-17 11:06                     ` Tanay Abhra
2014-07-17 11:34                       ` Matthieu Moy
2014-07-17 11:13                     ` Matthieu Moy [this message]
2014-07-17 17:12                       ` Junio C Hamano
2014-07-16 12:22         ` [PATCH v9r2 2/2] test-config: add tests for the config_set API Tanay Abhra

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=vpqy4vsme4w.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=artagnon@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=tanayabh@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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