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.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,T_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 BDC0C1FA7B for ; Wed, 14 Jun 2017 06:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750771AbdFNGCX (ORCPT ); Wed, 14 Jun 2017 02:02:23 -0400 Received: from cloud.peff.net ([104.130.231.41]:39712 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750745AbdFNGCX (ORCPT ); Wed, 14 Jun 2017 02:02:23 -0400 Received: (qmail 767 invoked by uid 109); 14 Jun 2017 06:02:23 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.84) with SMTP; Wed, 14 Jun 2017 06:02:23 +0000 Received: (qmail 8578 invoked by uid 111); 14 Jun 2017 06:02:24 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.84) with SMTP; Wed, 14 Jun 2017 02:02:24 -0400 Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Wed, 14 Jun 2017 02:02:20 -0400 Date: Wed, 14 Jun 2017 02:02:20 -0400 From: Jeff King To: Junio C Hamano Cc: Johannes Schindelin , git@vger.kernel.org Subject: Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory Message-ID: <20170614060220.pjb26zqgbtbtpxpy@sigill.intra.peff.net> References: <20170610101813.n26wmxcueicecptz@sigill.intra.peff.net> <20170613114254.oo6r6oqwtchvjuim@sigill.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Jun 13, 2017 at 09:40:49AM -0700, Junio C Hamano wrote: > >> It is really tempting to avoid the extra strbuf, but then the error > >> message would change from > >> > >> error: missing value for 'alias.br' > >> > >> to > >> > >> error: missing value for 'br' > >> > >> which is of course no good at all. > >> > >> And since I already have to keep that strbuf, I'll simply keep the > >> config_key_is_valid() guard, too (because why not). > > > > Oof, yeah, that is definitely worse. I'm fine with keeping both parts. > > When you replace Dscho's "compare 'var' with 'alias.br' that is in > strbuf naively with the "skip-prefix and compare with br" without > changing anything else, i.e. > > if (skip_prefix(var, "alias.", &key) && !strcmp(key, data->key)) > return git_config_string((const char **)&data->v, key, value); > > it would cause the "br" to be fed to git_config_string() and result > in problem reported for "br", not "alias.br". > > But this can be trivially fixed by passing "var" instead of "key" to > git_config_string(), no? Am I mistaken? Right, I wasn't thinking. That is a perfectly good solution, and matches the usual mechanism in other config callbacks. -Peff