From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,DATE_IN_PAST_24_48, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MALFORMED_FREEMAIL, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FB58C433DF for ; Mon, 13 Jul 2020 19:38:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E6E82067D for ; Mon, 13 Jul 2020 19:38:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="DaNvStw8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726460AbgGMTii (ORCPT ); Mon, 13 Jul 2020 15:38:38 -0400 Received: from mout.gmx.net ([212.227.17.20]:42139 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbgGMTii (ORCPT ); Mon, 13 Jul 2020 15:38:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1594669105; bh=2cqMFw5lS0dkMuIa/W8e072/bjvYbsG+COvB27DR3Ic=; h=X-UI-Sender-Class:Date:From:To:cc:Subject:In-Reply-To:References; b=DaNvStw8M3XJpZP++yMUPvhav6QueKVS/mj1Of7Xkf/ip0T9VL5o1su1JLn/sbmA4 JMlC6crjxOcg78gHxFojegCDHx/ofL+jaqlcs7Zm6JMsBvjOII0ogs8xTWiI6in/Vv w6W4nD3qBPJrHjuKg1kk/8hsAXrbr9fj1KdJpuR0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [172.28.26.78] ([89.1.215.195]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MatVb-1kSkTS04hH-00cMkb; Mon, 13 Jul 2020 21:38:25 +0200 Date: Sun, 12 Jul 2020 10:19:40 +0200 (CEST) From: Johannes Schindelin X-X-Sender: virtualbox@gitforwindows.org To: Edward Thomson cc: "brian m. carlson" , Johannes Schindelin via GitGitGadget , Git Mailing List , Don Goodman-Wilson , Derrick Stolee , Jeff King , Matt Rogers , Eric Sunshine , Taylor Blau , Phillip Wood , Alban Gruin , Johannes Sixt , Denton Liu , =?UTF-8?Q?=C3=86var_Arnfj=C3=B6r=C3=B0_Bjarmason?= , Philippe Blain Subject: Re: [PATCH v4 0/9] Allow overriding the default name of the default branch In-Reply-To: Message-ID: References: <20200629224113.GC9782@camp.crustytoothpaste.net> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K1:zslolk39pLEp0LpNc47II5CD45Z0U+xzg1F2WN1nqj4GCGHrpYW IELTLm3uTC06rQqaClva2a3lLc30nFK7rVK8C37P1T62lLxvsVr/oEio6hTFht/QTA2BUeV vgpgS36KaMKAZVoIs0U3I6ZXdmeJLdRC5xY/lInH/mSd6G534g7QbLRQaaPFwg3Ob+iFUOW JNvRq8a7nREOAhcpePhqA== X-UI-Out-Filterresults: notjunk:1;V03:K0:tzGYA8NRsxo=:FlfI81Bye/ViLz5m3Kf3Yx Sh3H+ARMXQNpv1dx1skbwkaGUs7sYfLCmGjugqs0kOp3ZXzbSCgdiPoQL1QNtVtbR+gQjXLCC BPH1gpmfHJGX+9FOb/Nem1GlgqklEcqJ7VqtmkiW+BMFxuXMzfdLzMFbup+OZBp4elk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8zb3LEZt0TPtUGWvQLjqjpp 89F4AiiLRuabr/6OJhWoLFgrRpmhfN/zUGiVg8A== Content-Transfer-Encoding: quoted-printable Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Ed, On Sun, 12 Jul 2020, Edward Thomson wrote: > On Mon, Jun 29, 2020 at 11:42 PM brian m. carlson > wrote: > > > > I'm very happy with this and the way it's progressed since v1. This > > seems simpler than earlier designs, and I appreciate the improved focu= s > > on avoiding special-casing branches, since I think that will make it > > easier for folks to choose branch naming that suits them. > > > > Thanks for working on this. > > I agree, this is an improvement. > > One thing that isn't obvious to me, though, is why templates take > precedence over the command-line option. I would expect the command-lin= e > option to be the highest priority option given, just like configuration > values specified on the command-line override values from configuration > files. Side note: I have not tested this, but I trust you did, and my reading of the code agrees that it does this. The reason why it works that way is that while the `copy_templates()` function is called before the `create_symref()` call that creates the `HEAD` symref, the latter call is guarded by the condition that `HEAD` does not yet exist. Here is a link that highlights both calls (and the code in between): https://github.com/git/git/blob/v2.27.0/builtin/init-db.c#L229-L270 Now, it is probably not the intention of the code to prohibit the config setting from overriding the template files, but instead it intends to guard against overwriting files by running `git init` in an _already-initialized_ repository. And I don't think that it possible, really, to change the logic without making the effect quite hard to explain. The truth is that overriding the default name via editing the templates is just not a very good strategy, it is fraught with peril, as e.g. `init.templateDir` is a thing that can be easily specified via the command-line (`git -c init.templateDir=3D/tmp/my-templates init`). Ciao, Dscho