From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796152301; b=4tvlPx5WOg+3egW+ggtGOjioiqV1zmRE5/pkjLwUdLBlhgeOJlOzwsSvjc0yOjk28GDA ZelfD0TjS+6/dsEyJiNPxf4TXiAb3WYHaNc6wYjjODsfScqmqwwETWh9ePi1xKrUJBY0O eg0vlwsqC8XEQFvDMCpQiGEDiI7zaNUG7GtdvwU+rK3FqhfdJKZwZalPk0+vrLR2Fflgg dIc+yMd34bfy7y+7JgYRfEUmlJj5GmfRplur6TTu94M9PgbER4nZC/i2rz4vy0aY5Swtn Gp3m6Ynx3BkfryUXurKLSfGqN85PybjiAqR3k5vplkNHjHlkN/abMWQtOvOPo32nzuA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796152301; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=Y92Yis+9uSTVEfGdDJfSRMLJ+j4cKiqZ3xcGcZ88jQI=; b=Ait2SR7oGhOBCnM6avVtKByLM5E2tO3WRRPZv/Iy6iM7s4kDesPefHvhHHUEiIlcWtxf MlzRmu0k1LQCf2kRzpbtCdylQD3RqT+TEczJmo19d3SmZ+TWxsLS24jJlOOOk2fIixV45 9JzDmKhvpsFLPm/ct7+xuCJ3vV19OUzx63EM6rtsrAxDZww//i3lbqqWhrk15OLsNLq2w ArSp1boqinUkdSRkup7odUufDP++XFF1ZXKI/4wMIPr/S3t2DcRXaNYxYRUzeSKcG1vun qIKxSSt8oItB39jGBuQTqMxg2R6bHzMY12HJG2nPIuObPYvxV7ARhqaar4h1PdBh8+Q== ARC-Authentication-Results: i=1; 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=mUBNXCNg; arc=none smtp.remote-ip=74.125.82.46 Received: from mail-dl1-f46.google.com (mail-dl1-f46.google.com [74.125.82.46]) (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 8267B606A31A for ; Tue, 1 Dec 2026 19:11:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8267B606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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=mUBNXCNg Received: by mail-dl1-f46.google.com with SMTP id a92af1059eb24-1b5ade5e0c1so6311973c88.1 for ; Tue, 01 Dec 2026 11:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796152301; x=1796757101; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Y92Yis+9uSTVEfGdDJfSRMLJ+j4cKiqZ3xcGcZ88jQI=; b=mUBNXCNgS6GgIOmJsh3h6NQ+QQne+zI7Igaz1pP5d6dx+35GClvCy5qTAJ2DOpd+8y gpPD978Z+CstIph1pVEfblPyqtC2+Rim2ZIR4lSIMutmr1DRCHnhDPoIQa0hrbH+2pfw JIkJtIujzz+892b9IpNVqQ5IA/qY0wNqUJHAsSgCSy1tdrbjWBFme6P9G+Rd4tIWfFv3 Y31l0N89UE6aLWZmcfAt4aHVsUfLTYGoLI2920ejDSnn/c3rIDtA3T9XuYS8Xqd7LcRW oJptrN1P5xsrB5LSf1cdgvDniR3Zl/N6qCC0kyM/UONgrtnqb6XhQW0HJF4IP5jV38C3 6HEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796152301; x=1796757101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Y92Yis+9uSTVEfGdDJfSRMLJ+j4cKiqZ3xcGcZ88jQI=; b=pzW2fUegkohUO1fj1tlQP/rNi7nWS1f6Fr4xIMALonloOc3BOcowkbkBlOwlrrgjJg ztq4NyLPQJwqYV0VYYnfkqQrV3ptdoSpS6NSRy9e7yCrRVb8fM/21h0q3ve9dApo00K9 CSUCf6FtUxN7B+JYU5S25C+LdEXoIC1PCw0tpmRb0ePuGjFOrTymEcYtd76q8JIgdMgq UzGLeG3thHc57WPMFmPLXJWG5VZB1PjSBdgCIPqZVFIXglRcgLkAaYl3yl3ZxMorHFhJ 65G6oxDI/7iJlQpUkUZLYsMfYb+qqc5e4m42qnS/6jnpEUqmjYbgMEdMd7W1ckQHis0M +63g== X-Gm-Message-State: APuU4Z8jDI1/xPlDwPnVQCDaMvoWB0LEHajaKLQ/STvnMrQ/ZIA9hawk S3DdbAIIs9KUdxYwaNKx5CsKnDO6zXGRS2JyLCp0yaKGlVyEAcphEVNs X-Gm-Gg: AZFdTZcFSQE5SeKu1nLdS63jnuYrxQ1YTfQtgyf81KaHdaoJ9B1YdGLPaunFPMgl+kv 81DeOCEFAKZ1jgdw/JqRWOJQDn/Uydk0+1W0IVKwkxFYXy9QKCd4m3na1O++oixIquxqSspExMw VA6txgWfYM4VizcAIfieDybBICWZwTLvVoES1xdwW7EYE0I6LJM9d6C7qsr/Ek0yPtq5HkcoaaW HjtP3Kx1Y21Z+62nDAP5BwQ4ZtUYl9iEwrb0oHyW5to2y9otxb4p6AJA4SKgEuoCfZEhyzPC0xL 4B9/edbB+xJRmIviqvePcBVi+1+agZW1TZ9GOVaHC80cQG0ud815Jlr2zAJeUNYvWDwoRmRdUQT QTr4NOpPEkXkZ5Gs0KuKMe8bj4n/V8utfi+GOvJT/as622G8c7zL49x4+N3BfVcSmp2dA84vEfr YSNGl+WjZwydERmMg5Fwf8gX2ycedzCTn7lXxlGtMGXkZBK0xXMPdNS1UoyjfqQb7Q0ILPZ1j9y THjxr58/TxlHfTTcX3cDAUJoL/a+As1kJvO1dDwzg4fyItYkGsDVIw4NHFq+HHDqIMc5C5vqy0Q w2xD4QfI3FI94Y/bA5lpnR6HiVovDguuQK+RJR0jac6CvgUobiSokrHunmYXdK+A8Jfd3dx1vO4 Pxfo04bNQgGFM8D4268KHHA== X-Received: by 2002:a05:7022:7f01:b0:1b2:490b:6fdd with SMTP id a92af1059eb24-1b5568aeb2bmr31241800c88.24.1796152300512; Tue, 01 Dec 2026 11:11:40 -0800 (PST) Received: from localhost.localdomain ([223.190.80.135]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b59d8c0cafsm33166517c88.7.2026.12.01.11.11.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 01 Dec 2026 11:11:40 -0800 (PST) From: Aniket Gupta To: Patrick Steinhardt Cc: git@vger.kernel.org, Junio C Hamano , Matt Hunter , Mike Beaton , Phillip Wood Subject: Re: [PATCH v3] dir: ignore CRLF-empty and space-only lines in pattern files Date: Wed, 2 Dec 2026 00:41:33 +0530 Message-ID: <20261201191133.16201-1-aniketgupta3001@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: References: <20261106182945.1316297-1-aniketgupta3001@gmail.com> <20261129060057.74590-1-aniketgupta3001@gmail.com> <20261201080040.47247-1-aniketgupta3001@gmail.com> 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-Transfer-Encoding: 8bit > Huh, affected by what? At this point I have no idea what the issue > even is, the only thing I know is that we have an empty pattern now. The problem is a line in a pattern file that "looks empty" but isnt. It is either a 2 byte "\r\n" line in a file with CRLF line endings, or a line that holds only spaces. Git skips an empty line by default, however, these 2 lines only become empty after git strips the "\r" and the trailing spaces, and by then, it passes the empty string to add_pattern() which records a zero length pattern. A zero length pattern matches a path argument that ends in a slash because its basename is empty, so "git check-ignore foo/" says an untracked foo/ is ignored because of that line. In a cone-mode sparse-checkout file, the same line makes git print 2 warnings and disable cone matching. In the patch I try to skip a line which is empty after trimming. Allow me to start the message this way in v4. > Okay. With git-check-ignore(1) we can append that slash ourselves, and > thus it may trigger the bug. And this is in contrast to git-status(1) > and git-add(1) seemingly, which never have that trailing slash. True. status and add match a directory before they add the slash. check-ignore can be given a path argument that ends in one. > Sorry for repeating all of that, but I'm trying to deciper this AI > message and am having a hard time doing so. Claude discovered the problem while I was trying to understand the code around it. Since I am new to open source and English not being my first language, I use it to review my code and to correct my messages. I realize I am only making it more complicated for your understanding. > Okay. Is this a cosmetic issue, or is it something that results in > wrong behaviour? It does not check out wrong files, but it is more than cosmetic. With one such line in a cone-mode sparse-checkout file, git prints 2 warnings and disables cone matching. Because of that, the sparse index is expanded to a full one, and "git sparse-checkout list" shows raw patterns like "/a/" instead of the directory name "a". I can explain like this in v4. > Would it make sense to maybe clarify the rule to say "A blank line or > a line that consists of spaces, only, matches no files"? Yeah I think that would help. I will change it in gitignore.adoc in v4.