🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4180

Re: [PATCH] worktree: allow sharing root files with linked worktrees

#4180
From: Eric Sunshine
Date: Tue, 01 Dec 2026 05:31
60 lines
14773 bytes
On Mon, Nov 30, 2026 at 11:08 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> On Thu, Nov 26, 2026 at 1:25 PM Bhushan Gaikwad via GitGitGadget
> <gitgitgadget@gmail.com> 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/
Technical Details
Message-ID: <CAPig+cSLCcMzQGZggOBDnwjveKBqKuhNr5c=HFbnbvox1Fm0oA@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76745-linux-kernel-git=dewy.ru
References: <pull.2245.git.1795717517830.gitgitgadget@gmail.com> <CALnO6CAX0hNzQ5t99wTwvbrruH5XCu3mbOAM6vdy4ZLMRHWdcg@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76745-linux-kernel-git=dewy.ru
From: ericsunshine@gmail.com (Eric Sunshine)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] worktree: allow sharing root files with linked worktrees
Date: Tue, 1 Dec 2026 00:31:20 -0500
Organization: Usenet Network
Message-ID: <CAPig+cSLCcMzQGZggOBDnwjveKBqKuhNr5c=HFbnbvox1Fm0oA@mail.gmail.com>
References: <pull.2245.git.1795717517830.gitgitgadget@gmail.com> <CALnO6CAX0hNzQ5t99wTwvbrruH5XCu3mbOAM6vdy4ZLMRHWdcg@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1625124"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:1pdVOVzbU5FjSinHkmpcQ+ZxgdM= sha256:FsTmHQElhO+cMg78G94ByCAbideXj/xqIazbw7ONDEM=
	sha1:MWwwCopINDuMsPJigsBIZetSKZ4= sha256:9rWgo47n3MRAa8QmrquwDBfMSdkDq+A2G6Lh/ieOgOs=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 38DB7117249; Tue,  1 Dec 2026 08:31:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VlATFmN03iYL;
	Tue,  1 Dec 2026 08:31:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76745-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 42B91117231; Tue,  1 Dec 2026 08:31:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 951F2261E8; Tue,  1 Dec 2026 05:31:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796103093;
	b=f3rKGKwOQr/bwh5OB8bfnioKnBabTEwQCnMLNP1FZO3c6i/A0HVIB1eCrdH+B7vodpem
	 P7F1aoXjIgqjb8bBkm+NXbo7A1KOAdBccD+hTG4sU56ElHISx55jpPcAfhAx5T6NLTmvb
	 Cus8V7rWKAbkSNqyLNZOjNfT/2uMYIDcFAkRTjI0zvLi2Je+bJRJwvO6iL02lJe31lEUX
	 rlKh8xJ2crhaK7djEOtt6N8lw88pMnjKNX0CUeCoiU0ZFR4AR8E4RJXNDfS0VlUBstvNs
	 wBnHM7gK5pg953OArV2vhIxn/RbPIbSKgoKa7fOFLmVmyl6e/Q6rdOYxEXGQ7W1GMjg==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796103093;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
	 Cc:Content-Type:Content-Transfer-Encoding;
	bh=ABYm0cwCqi3Hc33YNvLNApm4ixTT9nMwBLhaVsL344U=;
	b=dHSYUYTAXLWtm+rf5kIfRVx2kKhT6wT4wuQpInoMBF6Rwq2bHc66MI8Kho6g+UQ8vgTD
	 aCpfQ0I34MnIGEfk3ECCv3kyYLChk5jBlWuAylvjBeSDOorU7HnbpMhLU4M/ppo/IN72B
	 6DUvKLuCW+8F4tcmMNRB/tkAFG2+NUs/iHoVBkfO5jRszwzDa1i9FoLurpn8MwcH9RZFc
	 +uZjvBTQVi2OsxB4cqM3/CB841Ydb4irNbEVe2FfojvP6RRXlg+nRYGNcBVsR11SUJ/B1
	 Ktb7JMhlQ3xjMJtVK6CT0aI0NSPrpoZWCBTErnwjzte5ppx5O5UmmmDaPENh6uKbHvw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=iXptfBZd;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id CF19B606A32C;
	Tue,  1 Dec 2026 05:31:33 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=iXptfBZd
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=74.125.82.172
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796103093;
	b=KYZ38i5Hv8vwXQlwt0gsrTNLa10W+ZOY2MlbuU+CXGZGsMpEH/BO3ie1w4yUb6QE0BQ3
	 6nq/Gtp15mgsvaCWhHEAqOMvgUaFXreRT1QjlsDgybvxhAUyVu/GAeNDZVgLQ0iVQ9HL9
	 XNsYU6sXZoybEami0YtyoCRuma6efudV/zQQVTT6cfKSYU9q8b5Z3TC9rDPCUKkEYGSC9
	 AxDMVGtD45QUNdPsF6Jnc7SUWui9g/wdhD/FhxuaBji/ZbobLFtEGjjvF7c3YTI8vGKx2
	 dek7ZKMY5r3CuLMN6QXlE21F1odEpkYyXLpBQb1OPfI0Qsb8a/dB0Xy2hRGORgd0/jw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796103093;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
	 Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=ABYm0cwCqi3Hc33YNvLNApm4ixTT9nMwBLhaVsL344U=;
	b=OouZcuj4yXqUBk8moRLnoZ9A/wQ7GR6BP4onkk3f0o8Eq+ibMwFfli7nA0VA73MUrs88
	 5BBEAsWpBXuGFsYSLGkvmsiFAIf8qyg7wBrDeEyOHjPnvirOkJNEg23TNmtbsl2HMhVV+
	 01WU8mWkXG2gBsfbvQXxpN+jIKEirra8BqBtXIHleFz9s5xK1B3SrAuMVPbyKJeSGrFog
	 vDKTWUTJjOSsGHJC+QlOISkwnuE9vbuRLMy2G7d8D95I+lOoSn/7lOOE+oUbYQoPI1odn
	 ymljAVqOUyfcrbZhgh+zGMEg07YV02tLW/LqjspDpq5KsIa506K3HUbCq1JzX4LHpvw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=iXptfBZd;
	arc=pass header.oldest-pass=0 smtp.remote-ip=74.125.82.172
X-Received: from mail-dy1-f172.google.com (mail-dy1-f172.google.com [74.125.82.172])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94467606A31A
	for <git@vger.kernel.org>; Tue,  1 Dec 2026 05:31:32 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 94467606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dy1-f172.google.com with SMTP id 5a478bee46e88-386a2dc17adso1130884eec.0
        for <git@vger.kernel.org>; Mon, 30 Nov 2026 21:31:32 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1796103092; cv=none;
        d=google.com; s=arc-20260327;
        b=JDFA6pqRUm8dZFnd4YaYGrJNU5A0pwsUUB75Dqi+8VcnpTlqkv+9j3fjVK9RYYD5ai
         Wrv3eHEQk7U0ZWHn3UcZbnyQPeFLStnOepHGAhqhVEdLmYOt9Khj08ys9UqI7pts1OYL
         dxayVHtsVrKq6Z8XtYIGbzu8EPAI1iki+MlBdDM9nTg2lb/GlxmKhQ61JMVyxSI+yBYG
         9iqs4GGjnli7u3TwirM8VT6wtz6n/N1srvoRGglcelTquZHV3NmoN0l3YL73XsXbM8Aq
         OSqLHCYcM/EuTWMMtmPnG2r1Ijb8wJBa/jFpNJO0fMO+6QB1JRnyLaJNKtrLTCL8XpsD
         jbdA==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:dkim-signature;
        bh=ABYm0cwCqi3Hc33YNvLNApm4ixTT9nMwBLhaVsL344U=;
        fh=CocEs8unc8Vw4TE9EPbIe13nF+3+e250UeTPFTHN9SY=;
        b=tBWFvSrNewZoPq+wjxtGLiaqbsSpIPOWnVt0h/h089nl+VXwHXxdKv0WXb1fl+CjIG
         BLPH3DZgFyDGBzvMj0eGHXz4sGWrQLqexEn1yfH8JUfgQYChnXo+GbtmzRB/kbatK2+s
         M+eeesoQpbS1FB/RELdVVGhtPPyQjm2NlJU8p4uQ+0ns07E4wKoHNAaqPtE5rf4a8tN5
         U+gXRrOyQif9g2EzYA85EZlnTj9YVgvH+f96ascwzPLBpB/SmyhPIjHXeO3C5go6feLx
         3YeZBqpRE/4vXMXMRb8a8w5KYzWabjMGqpNonTqC6bRNavr1sFEgXKV6XfFJjWandWqL
         5Q/A==;
        darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796103092; x=1796707892; darn=vger.kernel.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=ABYm0cwCqi3Hc33YNvLNApm4ixTT9nMwBLhaVsL344U=;
        b=iXptfBZdk3zFPsgBYolmadWpx9KYEGsr6/YOm9pPLQUu/M2VkMKdvQIyA3w7t/Q6Ux
         Whyv3CrkLDoNrtpxH3Thgbn44WrTewD5E9qvZ8k6OUYLIH/iqTNySZllKjp/s3iOgDpT
         jKHW4aDV8I2vwb8hzmOaOBVRhTGWIE7L1BEuPnCym2aBjri2Y6ET64XmOVheziztdd7g
         z03y6IERSBiYoFkYcpI3V1bALZikucSe27vuiM+Esc4GPwRa8YJxUGqnkU3NwCHZRW8j
         bph1udZ/Pxbs3J0kzohhm7cbhXlkEWaRdadMSlXYjXd5I9dLH8lekJcPS/1fU04N9vPD
         a3iw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796103092; x=1796707892;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=ABYm0cwCqi3Hc33YNvLNApm4ixTT9nMwBLhaVsL344U=;
        b=teTmRNuO0MZ/bN7FRtUCB7LjWMevV7AngdPRhAb1F8pI9En44e/D7GpAj/W+BxCNjw
         Z26KoyeWzxSV7m74IK7yZqllBF8LLiPJ19cMultom/6ehymejtZ7ZchaXkNJlP4XSUC5
         +D+7jk0l7a9Qs/2SjS6rwgDFuHjSId8bAOsNOImfjobJnwCZ7/NLNPeF3bpGcVwwz0PN
         yi989L1b5IJI4iqMoiWxXTO/fHQsyP1SsWwJgDUNJoFTT5BnhqcNT4YH57oAtLhyW0Uf
         whFn+rfH1eilS0eR0GCXMkb4T1PDqQM9TN449QSPyvUcudi0fOCAZe0PoWaxd0nUratv
         cZ7A==
X-Forwarded-Encrypted: i=1; AL+hErHFslqoMmAZFFr9BOAOF1YbaQdt2m5oCdquT4PpR+AnSPYDl1nBVseDqFmQnFJaCsDkFyM=@vger.kernel.org
X-Gm-Message-State: APuU4Z8WqulqVcLNsUPCR8P+ja6dTrQjsAFrM1kz2fpaWm7wB18qbM2G
	bl6JXbC1DGuC9Rp99pMmnNqWFDxo4EtfMLvIjrLemOr+18hgV8Juje0TGmd3gccIG/OF39Pr+Zh
	KN6afyIMLyI+D0S0PU2wLlExd519SMsw=
X-Gm-Gg: AZFdTZdlxxzoy59CU3ArQGhWV9U4p90N9df/HLt31g3sx6KaUsYPGnb421kpRa4P+la
	LQMgL6t2JLAsExajpGyxdGT8aOUI0FQZO2mGjt3tBqTentimnFmVMwm6A6Exh/q/K7Mmrxucbvl
	16B9vjgffqsH7Fvt6JiAzhMSFtJVbQjcn3xGU+XE8EXuMlXukY4XzXm49GNUwsfc5sQ+POKAIr6
	7lWW+rzCdSbe9iVHaCEWTjZsykzDawT4xy8dalPrZ8AJWSaCb7xzQYWjtvP+FJJHmxXnveS2hWc
	zq5UwqZ5Uxrcc7N6tNufNOlGhQUDdSPpXnYeDaxP84brp6U82IMbySu4mE04kH9kHqkVI3lFzd4
	ZE1jwT1fvyulb5Z4vQ0i2M/0ltkZwHPguXqWLxl41ud6rFvW5jY46i6wS86X+u9vcaABLeWgo
X-Received: by 2002:a05:7300:1c24:b0:384:a0cb:a6d0 with SMTP id
 5a478bee46e88-3856de58f7fmr57819832eec.1.1796103091368; Mon, 30 Nov 2026
 21:31:31 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <CALnO6CAX0hNzQ5t99wTwvbrruH5XCu3mbOAM6vdy4ZLMRHWdcg@mail.gmail.com>
X-Gm-Features: Aa3M54qQ8ptiWJ7zT-lrn7rwLRsIwPV5w4KNqPX2tcYuSn3v5ljaHM6Zg_qKLEE
X-Cc: Bhushan Gaikwad via GitGitGadget <gitgitgadget@gmail.com>, git@vger.kernel.org, 
	Bhushan Gaikwad <bhushan@alfredscholar.com>