From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.156 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131872; b=hJsYUKmVpuAZ/DMxNdBfZ31rz3iP+R/bPf+BFb6443k1hmWjgNUKcUHaa/foW45LWmFz eIKmPmONsZfAC9nOiJl73BSwDH9KieTjtcuvAyTcjp1Xt17WnWJ9Ruh+6tTunDXM6w+wq 2fWn9VCf9x0pb5SJnADfwoerLp6t42LeGyq9a8xnuucj2JP59xWflFrGVh2gClqUDuc12 3G32e2cofQERj8Qg1ev7n8Lo107J9TK6jtqEgQSmAgujK69EhMqulv92ENJ3bKFsk2V3S kgTywBG07X9O0xs1FkfDBBY124ESUlJp5azdJpSsKEDn0pMMKkto4SjiXlAoLXbNO4w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131872; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=blILwL1CZ1VRiCVbPRbxZucXp7JmklACN0hUKsVKrPU=; b=X2+eb7c4WmXXIO/R/3HuzXA0fQGRAHZsnDSKhQJxojNc7eMh5FLXhIJcG+QkomVb8/fE DkvZIkKrhrbt5ZrQyC40etJlx5qIri52uAs5Ym6w+p5KA+/uk/CwjVJ1OCnWlFCTJuN5s q6Jkg17d/a/6Dfcamj43l5bmcyFPIZxCvq7C4vxPCzVEb3yiMEkB6INWA6qJjT5Vtu1sa O16jSDA5FPV2Dq20ZudyqCXcvqtmR9qJ2teYszUeay1zE8yB3jEEAekC9PWD//6jpBzgC dIGjkiOfpZCn/8eu+UuYB0/LwcYtr0spXSCKrV6AfaA68DGI3eCfwhhqH2esTfnW4hw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=chCv5zZV; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=diEfMPNO; arc=none smtp.remote-ip=202.12.124.156 Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A8B6606A325 for ; Tue, 1 Dec 2026 13:31:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2A8B6606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm3 header.b=chCv5zZV; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=diEfMPNO Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id 313A87A0561 for ; Tue, 1 Dec 2026 08:31:11 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Tue, 01 Dec 2026 08:31:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1796131870; x=1796218270; bh=blILwL1CZ1VRiCVbPRbxZucXp7JmklACN0hUKsVKrPU=; b= chCv5zZVZJJ13LMozhjsxjdVkIn/Er3Zh6NTQym1Zebk6teDlb9gb5cZftUDCmpp s0EpNXUxaT4kKFA+JQANunFXwIqO8M4AtlEDXX9wqin+C2dJPMRnn+shSxfG88QQ EMK1wB4WIdsMjgqdXfJEO1pJ6HoxHFxgotmxzGmaDWO1fYpGgRUU6lCZ2SqwLV/4 bs0rmiRfskbUfIsNVw2+wu1zVlYSpFfkcZkJJirCg+LlbGVfNGAypyC5ertU6Pxq SoT8P75+dypIQJxn+GJpSgPBNmsH7/t6i4rNHABhs6wtft105momnDr8ZvZUcrjp XEMfg5+gyvttu9awmsFgbg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1796131870; x= 1796218270; bh=blILwL1CZ1VRiCVbPRbxZucXp7JmklACN0hUKsVKrPU=; b=d iEfMPNO/tuXLbRqElgGIGqyeeXzC17OH0WW3Dn3THF/92crPmzsXeDXB5JrxPUV1 rYLv9bMSWkV/LzCqK3Kz2lBmiSCG8Ifq5DjH2bYlhvr/nFllabrjU6ClcVqoijRc P3NFxlo9BzEODGGjgD1iEWOReSCmHmRObPBsTwRagA5gLj3aE2YJay5Ix7V6ca36 s69nqrRQ9ubn1s5Q5Ok4OTegyKaGixaQkQeYicVY6++tZAvcPPuGaEEJxjQJrIUh J6xZrlztBCY+TH8Yz1o7bOMKVolq9AEEwVF8/1yuXPv/DHpyy8XSTTR8b3o2lNrb RUIZ1DHB4TzUs/Q0H1DYQ== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796131870; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:S4KnaymNEkdePc6xw+bXJ2QukpUlwhb15T0WdpdNZVlpZyY wgTQXag9o06zTlfaDZ4NyTROVsxYhIg90L6RfV7gOMigMw38hC/Um0LwkK68wTnT JeeQBNa1Qd1t0wxCqPHz2LYMHw3tllgbIAp/tK8aaSYVcY5r09oP0O9tITNU9Sds erim2Rs27k3rSFfCkgl7Kkw4xATFOBQT9hDrT36/jmUEhOO2A30QiLLGICkTAcjx S+IYuKC69JtA3BqWKaeNih8xD6bmu6j1QmkaEm9Gqg6C9Qd6nP/W8SZTwZR9ESED QEUyECBBNP1jV/gUzHIT+E3LBYDV9ZRmhfs/gFw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=13; hn=cc,content-disposition,content-transfer-encoding, content-type,date,feedback-id,from,in-reply-to,message-id, mime-version,references,subject,to; Message-Instance: m=1; h=sha256:JHoiLIvakSCk//NLoPaKmxb93qyrDl4n4nZOe7shhSY=:vjeCA4Nt48CDTHUAIZNkJFpSmY09a+IBRGiUvBnhmQI=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTF9TPi9xMIP3L3dfj6b1mcqhfxM1pZ4AheXu6Txb2B94BaaxoNLBaXP8LIcxdhxex BsdswrtpU7XbGrwV6KFibKj5+Wm4XydOO8XT32TZduMvs90uEQ8sQygJ1gFVwzLC0CwDjQ KhcKz12adNe+vG+Ouecz9aPt07pZzous+8Gy4mZIxqu0OZklLIbptjyfA2TSF5HETDBI10 edPO5dqHy6sYsC92y4/jmZmMug7TN9hBXxTE9kjqXHKgx3nwXfrG3xM62Phabk8LP1MU8g FhT1VPyA6wDSqBkOJpuuKkgcLd3YDHLstI0MGO5DFAW/WYiqAF90pKAGK7SieOriKifDhO A1NvLjekmOhYP8mu1gNfAxrTZrtxw/dRXwxDGko/ndv9UA91AeahTAN+RcnvNASxXT1eNT w5Laq0lDAKVqNMxbJ97eb9ONRw4KCNavrKTPmqyd3YuBo03CvBiS1YDqQRYwwqUDaqC6it sjTE3ymZfVbviIS7s+UH/kTzsYemXyqKW9/52ZGKR2107rhSPX4d6bfmhQVSIw6aDl32Ow CP1yzJPDQ5Ak/w8KkJIUsZMWqfIMUxDUbM5N18JUkL6JLuvjFSQlz6imBdG8k3h04Q+C8t qvPUZIEDCq7GCJkOFGymunFBPFaTSk/jO3FKaRgs5pHpaVMxLV2b9fKovCvQ X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Dec 2026 08:31:09 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id cf422544 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 1 Dec 2026 13:31:08 +0000 (UTC) Date: Tue, 1 Dec 2026 14:31:05 +0100 From: Patrick Steinhardt To: Eric Sunshine Cc: "D. Ben Knoble" , Bhushan Gaikwad via GitGitGadget , git@vger.kernel.org, Bhushan Gaikwad Subject: Re: [PATCH] worktree: allow sharing root files with linked worktrees Message-ID: References: X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Dec 01, 2026 at 12:31:20AM -0500, Eric Sunshine wrote: > On Mon, Nov 30, 2026 at 11:08 AM D. Ben Knoble wrote: > > On Thu, Nov 26, 2026 at 1:25 PM Bhushan Gaikwad via GitGitGadget > > wrote: > > > Ignored configuration files such as .env often need to remain identical > > > across linked worktrees. Today users must copy them manually or install a > > > post-checkout hook, which is easy to forget and can create divergent local > > > configuration. > > > > > > Add a multi-valued worktree.sharedFile setting. For each configured > > > root-level regular file, worktree add creates an absolute symbolic link > > > from the new worktree to the primary worktree before running the > > > post-checkout hook. > > > > > > Reject nested paths and source symlinks, avoid replacing checkout files, > > > and fail cleanly when symbolic links are unavailable. > > > > The limitations and design choices seem odd to me: > > > > • On what platforms do we not support symlinks? Wikipedia suggests > > Windows has equivalents, but our mingw compatibility layer says they > > are disabled unless MSYS contains winsymlinks:nativestrict, and of > > course I don't know what other platforms do to customize the build. > > • Why reject nested paths? A project at work has api/.env{,.example} > > which might benefit. > > • Why use absolute symlinks? I suppose that might be annoying when a > > directory might have a different absolute path on different machines > > (due to NFS or something)? Is it a security thing, something about > > relative symlinks becoming a nice target for some kind of exploit? > > For what it's worth, these are the exact same questions/oddities which > came to my mind upon reading the commit message. > > > I am somewhat negative on making Git do this automatically, > > personally, especially since the example ".env" is typically ignored > > (i.e., not managed by Git at all). But that's just my opinion, so if > > the design is fleshed out and others are positive, ok. > > I am similarly negative on this proposal. While I understand that it > addresses a real need, I can't help but feel that it is too > specialized and narrowly focused. It feels quite out of place for the > otherwise generic worktree mechanism. I could imagine having a more > favorable reaction to a proposal for a more generally applicable > solution, however, a very general mechanism already exists in the form > of hooks. (And, yes, I am aware that the commit message mentions the > potential downside of employing a hook for this case.) > > Bhushan's alternative proposal[*] of instead documenting a hook recipe > in git-worktree(1), on the other hand, seems reasonable. Adding a > sample hook to .git/hooks/ might be even better. > > [*]: https://lore.kernel.org/git/010601a22ff63cd4-ad6646b6-c34d-414e-ad82-1338e97b7d96-000000@ap-northeast-1.amazonses.com/ Sorry for repeating what you're saying, but my immediate reaction was also that this is way too niche of a use case, and that adding a hook would be the better solution to this. But the other question is whether you really need a hook in order to achieve this. In other words, isn't it sufficient to have a small script that wraps git-worktree(1) to create the worktree and copy over the files? We typically only add hooks when there really is no other way to achieve something, e.g. when it happens in the middle of an operation performed by Git. But that's not really the case here, as it can be trivially achieved by such a small wrapper script. Thanks! Patrick