git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug v1.9.3: Spurious whitespace warnings when using git apply with the --exclude option

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 6, 2014, 20:12 UTC
Message-ID
<xmqq8un1ml7e.fsf@gitster.dls.corp.google.com>
In-Reply-To
<332C033B-7809-45A9-9F91-CC3A92090B86@apple.com>
Peyton Randolph <prandolph@apple.com> writes:
Show 6 quoted lines
> Bug v1.9.3: Spurious whitespace warnings when using git apply with the --exclude option
> ...
> EXPECTED RESULT:
> No warning about adding whitespace errors because no whitespace
> errors are added to the tree since A is excluded and B has no
> whitespace errors.

By reading the way the code is structured, I would expect (I didn't check) that all versions of apply that supports whitespace error detection with include/exclude option to share this symptom, and this bug is not specific to 1.9.3.

In order to decide if a hunk with a new whitespace error should be reported, the program needs to parse the patch input to at least find out what path the part being parsed is to be applied, and the whitespace error detection and reporting is done when the patch input is parsed. After the part that applies to one path is fully parsed, it then checks to see if the path is included/excluded and omits it from the --stat output and also actual application.

That part of the code needs to be restructured so that at least error reporting (and preferrably error detection) is not done when the path is known to be excluded. Let me see if this can be easily done.

Thanks.
Previous: Peyton RandolphNext: Junio C Hamano
Message 2 of 6 in “Bug v1.9.3: Spurious whitespace warnings when using git apply with the --exclude option”
  1. Peyton RandolphAug 6, 2014
  2. Junio C HamanoAug 6, 2014
  3. 0/3 Two fixes to "git apply"Junio C Hamano, Aug 6, 2014
  4. 1/3 apply: use the right attribute for paths in non-Git patchesJunio C Hamano, Aug 6, 2014
  5. 2/3 apply: hoist use_patch() helper for path exclusion upJunio C Hamano, Aug 6, 2014
  6. 3/3 apply: omit ws check for excluded pathsJunio C Hamano, Aug 6, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.