From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id A46371FBEC for ; Thu, 9 Mar 2017 11:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932195AbdCILwW (ORCPT ); Thu, 9 Mar 2017 06:52:22 -0500 Received: from mout.gmx.net ([212.227.15.15]:50412 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754289AbdCILvx (ORCPT ); Thu, 9 Mar 2017 06:51:53 -0500 Received: from virtualbox ([95.208.58.21]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MGSDw-1czC8Z2WmW-00DDUh; Thu, 09 Mar 2017 12:51:07 +0100 Date: Thu, 9 Mar 2017 12:51:06 +0100 (CET) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: Junio C Hamano cc: Jeff King , git@vger.kernel.org, Duy Nguyen Subject: Re: [PATCH v3 0/9] Fix the early config In-Reply-To: Message-ID: References: <20170304073952.drfgy7jacnlm6tum@sigill.intra.peff.net> <20170308073035.pt5ysp6bzpozoqps@sigill.intra.peff.net> <20170308174237.cm6e5uvve6hu7lpf@sigill.intra.peff.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:rKHdJU7s+b2JlpJMHsvzbCodDJSqZImyCPBt2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precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi, On Wed, 8 Mar 2017, Junio C Hamano wrote: > Jeff King writes: > > >> Or are you discussing a more general issue, iow, anything that can > >> work without repository (i.e. those who do _gently version of the > >> setup and act on *nongit_ok) should pretend as if there were no > >> (broken) repository and take the "no we are not in a repository" > >> codepath? > > > > Yes, exactly. It would have been less confusing if I picked something > > that passed nongit_ok. Like hash-object: ... or like testing the early config directly? > > $ git init > > $ echo content >file > > $ git hash-object file > > d95f3ad14dee633a758d2e331151e950dd13e4ed > > > > $ echo '[core]repositoryformatversion = 10' >.git/config > > $ git hash-object file > > warning: Expected git repo version <= 1, found 10 > > d95f3ad14dee633a758d2e331151e950dd13e4ed > > > > The warning is fine and reasonable here. But then: > > > > $ echo '[core]repositoryformatversion = foobar' >.git/config > > $ git hash-object file > > fatal: bad numeric config value 'foobar' for 'core.repositoryformatversion' in file .git/config: invalid unit > > > > That's wrong. We're supposed to be gentle. And ditto: > > > > $ echo '[co' >.git/config > > $ git hash-object file > > fatal: bad config line 1 in file .git/config > > > > Those last two should issue a warning at most, and then let the command > > continue. > > Yeah, I agree with that as one of the worthy goals. IIUC, we > decided to leave that outside of this series and later fix on top, > which is fine by me, too. How about this on top, then: -- snipsnap -- From: Johannes Schindelin Subject: [PATCH] t1309: document cases where we would want early config not to die() Jeff King came up with a couple examples that demonstrate how the new read_early_config() that looks harder for the current .git/ directory could die() in an undesirable way. Let's add those cases to the test script, to document what we would like to happen when early config encounters problems. Signed-off-by: Johannes Schindelin --- t/t1309-early-config.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/t1309-early-config.sh b/t/t1309-early-config.sh index 0c55dee514c..027eca63a3c 100755 --- a/t/t1309-early-config.sh +++ b/t/t1309-early-config.sh @@ -47,4 +47,29 @@ test_expect_success 'ceiling #2' ' test xdg = "$(cat output)" ' +test_with_config () +{ + rm -rf throwaway && + git init throwaway && + ( + cd throwaway && + echo "$*" >.git/config && + test-config read_early_config early.config + ) +} + +test_expect_success 'ignore .git/ with incompatible repository version' ' + test_with_config "[core]repositoryformatversion = 999999" 2>err && + grep "warning:.* Expected git repo version <= [1-9]" err +' + +test_expect_failure 'ignore .git/ with invalid repository version' ' + test_with_config "[core]repositoryformatversion = invalid" +' + + +test_expect_failure 'ignore .git/ with invalid config' ' + test_with_config "[" +' + test_done -- 2.12.0.windows.1.7.g94dafc3b124