From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.158 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795922464; b=ldJVBQwQVBV6/MJmAvykUv9Eq2mOyk8y8NP2PBb+7HeaWEGDIe/fKGeCVxlrvz3o+nZ4 ROWiWL8CpUEArVBIY88veslscLyMpR3/+ASUPY1+YkKqWJk5tD7HjUg0YF8377G7HFPzo 6Hjrk7LpFpmu1LtDgivpM3YzvJzOOCgRs8S2uavq7xHg0/hjbubQsysT4hS2GQoVeGJqk lgDrtEBpDt/f+nWBPxtFYMzgAbYfVepHfC9/13zDmtjp85aljlu2sacEVjwWZfkaR5zZc QuNb1fzR4C7VpTDlahhoojWPhl7OA3vVWtda8hi8y3uPfvT6Ht+FwJU9t46+o8ssVpQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795922464; 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:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: User-Agent:MIME-Version:Content-Type; bh=rslbu5YV8SMQo6NfF3k1Woy2PHExTtROI8bLvrCIdXw=; b=vIkTPwPTbngBkMa3bVtmQogD1Y9Dojm+Fuz1UxX34W1yHy5JJUTzYjClWloNVlNZ5mUP Q6TJCVkE0MMbXhpIkiC415O49YmLPNg+WJTHVRbrscAhKtmrpV9vfTApnDJDwXdQEHB5h O5xM+yi3XnV7AFLZSmp85WpQ1w/lelih+xUTxu8gOVr2RsTxNtB40wu2tkyqIpVQY0dGP RCW7MGE+DyKysHXq52opooAQQC1aygkfXIPTE6DUBWkqLG9VfQcpYx5rlu336oQ+Qun+c zc9xiHI3noVAIIOFPuVOLrd+fv4gZj7NQEg6c4V2Wn/qhtY0Ui+KXxHhqwsTMEzta+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=cLW3Ng0I; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=UjSM6mJ9; arc=none smtp.remote-ip=103.168.172.158 Received: from fhigh-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C76DA606A31C for ; Sun, 29 Nov 2026 03:21:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C76DA606A31C 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, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=cLW3Ng0I; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=UjSM6mJ9 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 1443814002B2 for ; Sat, 28 Nov 2026 22:21:03 -0500 (EST) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-07.internal (MEProxy); Sat, 28 Nov 2026 22:21:03 -0500 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=1795922463; x=1796008863; bh=rslbu5YV8S MQo6NfF3k1Woy2PHExTtROI8bLvrCIdXw=; b=cLW3Ng0ID+FeTtKcMoRkbFxAx5 2RMX/nHwVBaBDjAekMS9adP+JXOoz0UE7sq6SrClAcBoFW8QjP0mTk16+r/UpLWf t4jMJjfgubMk9QPJ94Ca2DlXzB0/AH5L+uIHZ0Xj5Y/Ui6NmtfUJ074s4vewtWWP rmILHKeGUqHOUP/IV6gF7oSTDNy9Hg7atZLlqUaklsQF0TP9PhGDnlSwd9FlWOMO TexbMXgbuB62iMHlhkkSlt/6SobGr2rxRlY4vO4TPB5oydadKyklWgFVimCl2zh3 +W3y8XO7ach6CpiFAF06g8PyQlOY6KTw1aY8LoSAT+eIuRVa96VREj+Qsj0w== 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= 1795922463; x=1796008863; bh=rslbu5YV8SMQo6NfF3k1Woy2PHExTtROI8b LvrCIdXw=; b=UjSM6mJ9WkOBL9zZG5IIcS/9yaT9JrnZMazcnEKJfkuadYB8Zve ougIjRP7E0dX3L8bCud4Ak7/ikmfjQ9LTPQDBEPZJffZNwrJG8B0Ie3KQF5tQ6Gy 1HByBO86fm1Ij9yhACPljpLPpqMrT25Z4ANbI8FymF4blqXfWZEq9hNq7/nW3j5y MUIHFRRndvXGsO9rbMtNa1qNxAYkSkp2aGv8un+SSsORw32PZ4yVCKe7dvQKMk4B hPEhwwhd0+NeLEaHmHvQ4mC0ssKwcuZ5f1azxKWnDIO6D6ahkZ8YBYQZB62dT/gA 8ZkJM/bCI/jA1BKKpeQr90rD06+uEXufjVQ== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pobox.com a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1795922463; d=pobox.com; mf=PGdpdHN0ZXJAcG9ib3guY29tPg==; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm2:rsa-sha256:IHmVCNbk4xhpcQwUe5QYLGXRWrJehPcbMshHBtcw7H97Hiv /6I4767IPwvIMsY8tcmoMjAslTi2dqT7pmyd6YWnnTNnKkcqwRj9wiQEsx0FBEZ8 Gs+3PyWy+4i0THRVAGePViJnXibzKyhPcvP/iK1WKh3ukKdqP+Cg4+glhOr1tgvo ujPlfOz5GmxTonSihQFk6fV5v6DS6n55BsTNPDig+YTi0GDeJ7PusXOXKcj/NBJq bZ2uSrXRehPWddOOCJw/W6XHSWVjfyEUd6EGs82uYdHI/fMMty2wIf9r+d1kXzQz 8/mQwUudAYmjxi+3+Y41uGhi4i3CQlUqz3ZGzfw==; 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=12; hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id, mime-version,references,subject,to,user-agent; Message-Instance: m=1; h=sha256:qjZbtXtimdkmckORgIsHgv9UygNCl3/MNUuzryuVt6k=:xoKoNCmlAEGTiDKN73tp15gqLpFphFgZbZWGbB8Mwfk=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEe0u49OLScrs3Lu2fcYsN8vjRlTOPlDWfy/vPP6Dakhwrp+JyDXael4EsSWkybGh eBNwiW6/e89JB15AOG9BV6I+P61FAePUTmNqzdyb/647NvYID+AMxetMjJ6Jxo/z2OhPow MlS3+QcNVLqF+fzuOkFe5eH6f8Uf+ATEOC7FsYMOzkmOYz7tLKX/fMVgDYziTrllCbPs5U tAuGgeRBAJyEgx/1TsU86ls+/gf3l24a/J2vNNjN+QRdfThPJa5e1mcBljK+LOPq0v+Yeg Hl2AgO2LZql2cxyIQ615T8g13DDxTx8/IYJ3EdgHy+m3et0FX+w+KaZhqU9JS0LxJjYXd7 cjxolwUEVp5GP0kBEnaySHfkEI59Pwzt1V4ggu0jiHFOUnZl/Jo4/vVoFJjGsQ/Scw55pb alopRo8ih7F2D0rgYJjAuMMZKnj9LPQNzfmIucG7/x2ShrKrbquLnOq/qn59e/FolxBoAC J/S7GRKVSxXcPsoBjKbb8WDQVDt7MWx9OAsYxXLwVr3k3LNd86P8X3mfQcUTwLGp0myYY1 ysHiVjMGfR4DzU8SSv/UGCU/NHneq2pbKaxz2zyOTVhWWlf4JP31BdZWmAVQRfJe0p7s2m D9aHEabRKZk0EqnWoR6J0lDgOkSd0yIRvNM1m2E7S7BSehaEQ51j/+RPCH5Q X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 28 Nov 2026 22:21:02 -0500 (EST) From: Junio C Hamano To: Aniket Gupta Cc: Matt Hunter , git@vger.kernel.org, Mike Beaton , Phillip Wood Subject: Re: [PATCH] dir: do not turn blank ignore-file lines into patterns In-Reply-To: <20261128104728.77555-1-aniketgupta3001@gmail.com> (Aniket Gupta's message of "Sat, 28 Nov 2026 16:17:28 +0530") References: <20261106182945.1316297-1-aniketgupta3001@gmail.com> <20261128104728.77555-1-aniketgupta3001@gmail.com> Date: Sat, 28 Nov 2026 19:21:01 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) 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 Aniket Gupta writes: >> This avoids adding a pattern which becomes empty after stripping a >> carriage return and any spaces. I wonder if it is also worth fixing up >> the parsing responsible for interpreting such "whitespace only" patterns >> to match ".*/"? Either way, I think this patch is an improvement as-is. > > I tried that. The empty pattern matches "foo/" because the basename of a > path with a trailing slash is empty and match_basename() compares it > with the empty pattern. Making match_basename() return 0 for an empty > pattern fixes blank line and also the lines "!", "/" and "!/", which my > patch leaves alone. With only "/" in the ignore file, "git check-ignore > -v foo/" still names that line. status, add, clean and ls-files give the > same output as before. add_patterns_from_buffer() is shared with sparse-checkout through add_patterns_from_file_to_list() and add_patterns_from_blob_to_list(). Before any matching runs, add_pattern() calls add_pattern_to_hashsets(). When cone mode is active, add_pattern_to_hashsets() checks whether patternlen is less than 2, and if so it emits "warning: unrecognized pattern: ''" and disables cone pattern matching. Changing only match_basename() would leave cone-mode sparse-checkout broken on "\r\n" and space-only lines, and would still allocate unused path_pattern entries for every such line in ignore files. Making match_basename() reject zero-length patterns may still be a worthwhile complementary change (for "!", "/", and "!/", or an empty "--exclude=" pattern), though that can be a separate decision from skipping empty trimmed lines here.