From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=1.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,LIST_MIRROR_RECEIVED,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id CBE211F852 for ; Tue, 8 Feb 2022 04:14:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346826AbiBHEOy (ORCPT ); Mon, 7 Feb 2022 23:14:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346775AbiBHEOp (ORCPT ); Mon, 7 Feb 2022 23:14:45 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6499BC0401F2 for ; Mon, 7 Feb 2022 20:14:43 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id f17so17622316edd.2 for ; Mon, 07 Feb 2022 20:14:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bi9NFDMMwYTXbcfrd0udEAy4D9Mt21I4+/7fOi4KUMI=; b=n0SSEjyaJW0jTZOEhx1+NtU5UDl7TYWklxzgGMkWB6C1Ukg66Kdi7+gMIcxeFNVed2 pWlta3LnYM/9iPOUfWf8mbd9Z8Ptu7RKljly39mtRtmFM7/Mn7MVZGVgJ0AaLxx/7SRq P0GnReII0fyFywhFi8T6Hwld5Ug6YLmllxJhTUDpUaFJgbUTurcNa9Zs4mkFgdqoS4LH Rh0+bbKb1gfudRzElf0XRzUPlmH0Ve49Z8IsviC2iqzxLUdJHEMhYzfijkYBUUxELLLo wvhj5EGzAqjOUBepDmBRiUEqcIxYTyVy+O99rxHH+r1OK1e56Sep5yGV5dqpEqQlqXHe pOuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bi9NFDMMwYTXbcfrd0udEAy4D9Mt21I4+/7fOi4KUMI=; b=cpsMavsYBGhtL3vgAUpVM3ku6OOijBWVud0hLJckC1nDirLqbDGM35IadHPfnF7uDP epEW3XpjWFVPqiH77xogg/5+oulotSLza55RVdrDd5+ibfBfa5+d+McBOONz2e8Oj9s7 a0I1MOHRW941D/4GxHIL4NTO+uR04xZKLN7vyD7/N1uyKOErw1j1tRgm58V3zpyGyJrz jqFS/GJzU3JCSpB+aYcvslyq2ALDJ6EQjB+AtSFPd5jEcmPMEoDf4vgGAiEBLfEg3TQr UqOpus6Rome4nrkzGjH1eXIJBKv9WK9iPtktrhO06wyFr0jyLbo13T24CHeWDFMzTBG4 IX+A== X-Gm-Message-State: AOAM532N7cTx1hC1touhF/M9crKV9qQXiNN8TkmHGGHBCDJYG9RUWq8u HXs089atQJPYWWHgLp6h1s9Yxgjd+V3t8WH6uZ4= X-Google-Smtp-Source: ABdhPJxOKJj6WdD+FO2HTDen23SGMqya5MEAeKu4TrOJKRSf4vC3+1U+FJB812UaRcFRBpkImXgmTi+tfkE8cuxqqCA= X-Received: by 2002:aa7:da84:: with SMTP id q4mr2609297eds.380.1644293681756; Mon, 07 Feb 2022 20:14:41 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Elijah Newren Date: Mon, 7 Feb 2022 20:14:29 -0800 Message-ID: Subject: Re: [PATCH v6 0/6] Sparse checkout: fix bug with worktree of bare repo To: Derrick Stolee via GitGitGadget Cc: Git Mailing List , Derrick Stolee , Eric Sunshine , Sean Allred , Junio C Hamano , Bagas Sanjaya , =?UTF-8?Q?Jean=2DNo=C3=ABl_AVILA?= , Derrick Stolee Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Feb 7, 2022 at 1:33 PM Derrick Stolee via GitGitGadget wrote: > > This series is now based on v2.35.0 since that contains all of the necessary > topics. > > This patch series includes a fix to the bug reported by Sean Allred [1] and > diagnosed by Eric Sunshine [2]. > > The root cause is that 'git sparse-checkout init' writes to the worktree > config without checking that core.bare or core.worktree are set in the > common config file. This series fixes this, but also puts in place some > helpers to prevent this from happening in the future. > > ATTENTION: I have significantly redesigned the series since previous > versions, so most of this cover letter is new. > > * Patch 1 updates documentation around extensions.worktreeConfig in a few > places to improve discoverability. Several cross links are added to make > it easy to find the related areas. (The documentation for the changes to > 'git sparse-checkout' are delayed to patch 4.) > > * Patch 2 introduces the init_worktree_config() helper which follows the > documented instructions to enable extensions.worktreeConfig as well as > move the core.bare and core.worktree config values. This update does not > modify core.repositoryFormatVersion, since this is not needed > specifically for extensions.worktreeConfig. > > * Patch 3 adds a new repo_config_set_worktree_gently() helper method so we > can internally adjust a config value within a worktree, at least if > extensions.worktreeConfig is enabled. (It will write to the common config > file if the extension is not enabled.) > > * Patch 4 modifies the sparse-checkout builtin to use > init_worktree_config() and repo_config_set_worktree_gently() in ways that > fix the reported bug. The behavior change here is that it will no longer > upgrade the repository format version, since that is not needed for > extensions.worktreeConfig. > > * Patch 5 updates 'git worktree add' to copy the worktree config from the > current worktree to the new one (while unsetting core.bare=true and > core.worktree=*) along with copying the sparse-checkout patterns file. > > [1] > https://lore.kernel.org/git/CABceR4bZmtC4rCwgxZ1BBYZP69VOUca1f_moJoP989vTUZWu9Q@mail.gmail.com/ > [2] > https://lore.kernel.org/git/CAPig+cQ6U_yFw-X2OWrizB1rbCvc4bNxuSzKFzmoLNnm0GH8Eg@mail.gmail.com/ > > > Updates in v6 > ============= > > * Updated documentation to use "working tree" over "worktree" and "" over > "" Not sure what "" over "" means. > * Delay some allocations to avoid leaking memory in error conditions. > * Use "main worktree" over "base worktree" in comments. > * Was the empty bullet point meant to cover the new patch 6? Anyway, comments on the cover letter aside, the patches themselves are: Reviewed-by: Elijah Newren