From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CFB3302753 for ; Sun, 30 Aug 2026 22:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788130702; cv=none; b=oBDLMHl81otnWRC23KjiMIVZE9Kz1teN26paYurnv5ob0zdXztKDzJ8rimVWXCiOhnkEOXIdC/2BEtSOBnyxLqiDh7WrBbkHI03EzJEOiGmaveWUNz2yHnDSSnqUFJuJrpagtO3HGAIrpbOVQaw3Dmca9A0izZc116P5Ema5oTw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788130702; c=relaxed/simple; bh=uh12N9XVf/slepGbAot7L5YaEXqLPlEttjl49T0gm4Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=IQOlGfdoiNHa4sVHOsLOpzVdNAT23B9c6ttd7fl9vBKVij5dL8Z6EwTt9X+AdEN4JDa+IaHLOorcT8v5jtQdobFAvr+UDrjjeu6e9DidZmBp2iDXQzGlcwgwIH7IDY1CSeQeiZThaRgNA+aeYsJ6x5Aejsewwq+eyCxEOA0Si6g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=fGxliteJ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HbvL8QgK; arc=none smtp.client-ip=103.168.172.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="fGxliteJ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HbvL8QgK" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 7FBD5EC0125; Sun, 30 Aug 2026 18:58:20 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-03.internal (MEProxy); Sun, 30 Aug 2026 18:58:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc: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=fm2; t=1788130700; x=1788217100; bh=SStq5occ/v kDHb4yrBRquQzB1R8eGUvos0aNt16Esgw=; b=fGxliteJdWJ8ck8Oe9ZEqKthhy oTo1Rjic9nwcRpiDPiPfivzl4UrMJExX5x3DwFOuGwtqOa/JJCeJdtbwo/xqXlfM p5hft7PzmTsPiucgNSwu4usCV+7K+uxGMPKPibOT/aX7m0CJ9HVIv2tAICqjW5gN iLTQsR9VnPjeldn2GWpafjrg3jKxW65Og/rHLtma0iahVeoufq/X3C4c9qi/fRn/ V/XtQYXEOV1UqXn0SrrFz2w3QuHZ9chZUSjdg0GdaVKtFP5c9GF4FvBGMRmCeH9a 0yaKgKkBZpAYb8BZEq/xMcQULf/UD5KsOcF5hyfGL0REpRmlWOXjQfhA+NkQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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= 1788130700; x=1788217100; bh=SStq5occ/vkDHb4yrBRquQzB1R8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A4WCHsGJZ6AwtoNNknw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 30 Aug 2026 18:58:19 -0400 (EDT) From: Junio C Hamano To: Diogo Castro Cc: Diogo Castro via GitGitGadget , git@vger.kernel.org, Thomas Haller , Jeff King Subject: Re: [PATCH] dir: fix negative pathspecs in 'git ls-files' and 'git add' In-Reply-To: (Diogo Castro's message of "Sun, 30 Aug 2026 15:57:27 +0100") References: Date: Sun, 30 Aug 2026 15:58:18 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Diogo Castro writes: > I don't think so. > > As far as I can tell, the "strip the common prefix" feature is a > performance optimization aimed at avoiding walking the working > directory needlessly. > So for `git add -- a/b/c a/b/d`, there's no need to look anywhere > other than in `a/b/`. > > But extending the "strip the common prefix" to negative pathspecs > could end up negating the benefits we get from this perf optimization. > E.g. in `git add -- a/b/c a/b/d ':!*.md'`, there is no prefix common > to *all* pathspecs, so we'd revert to walking the entire working > directory, even though `a/b/` would still suffice. I was wondering more about case like this: $ git add -- a/b/c a/b/d ':!a/b/x I agree that it is nonsense to compute the common prefix over only positive ones, and then to strip the common prefix from both positive and negative ones, and it needs to be corrected.