<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/apply.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-04-07T21:59:26Z</updated>
<entry>
<title>Merge branch 'jc/whitespace-incomplete-line'</title>
<updated>2026-04-07T21:59:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-07T21:59:26Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=55d867c547895b17af0093b339673c16e09a2042'/>
<id>urn:sha1:55d867c547895b17af0093b339673c16e09a2042</id>
<content type='text'>
Fix whitespace correction for new-style empty context lines.

* jc/whitespace-incomplete-line:
  apply: fix new-style empty context line triggering incomplete-line check
</content>
</entry>
<entry>
<title>Merge branch 'jw/apply-corrupt-location'</title>
<updated>2026-03-30T20:57:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-30T20:57:00Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=5032e70fc25ff18a3c16fb89d708884104c2d1a3'/>
<id>urn:sha1:5032e70fc25ff18a3c16fb89d708884104c2d1a3</id>
<content type='text'>
"git apply" now reports the name of the input file along with the
line number when it encounters a corrupt patch, and correctly
resets the line counter when processing multiple patch files.

* jw/apply-corrupt-location:
  apply: report input location in binary and garbage patch errors
  apply: report input location in header parsing errors
  apply: report the location of corrupt patches
</content>
</entry>
<entry>
<title>Merge branch 'mf/apply-p-no-atoi'</title>
<updated>2026-03-27T18:00:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-27T18:00:02Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=cb77c3a6a7f508776c5bdd874ee650ceb28dc1ba'/>
<id>urn:sha1:cb77c3a6a7f508776c5bdd874ee650ceb28dc1ba</id>
<content type='text'>
"git apply -p&lt;n&gt;" parses &lt;n&gt; more carefully now.

* mf/apply-p-no-atoi:
  apply.c: fix -p argument parsing
</content>
</entry>
<entry>
<title>apply: fix new-style empty context line triggering incomplete-line check</title>
<updated>2026-03-17T18:46:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-17T18:01:38Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=afdb4c665f664e04c0f68c930ad50e5b05be71e1'/>
<id>urn:sha1:afdb4c665f664e04c0f68c930ad50e5b05be71e1</id>
<content type='text'>
A new-style unified context diff represents an empty context line
with an empty line (instead of a line with a single SP on it).  The
code to check whitespace errors in an incoming patch is designed to
omit the first byte of a line (typically SP, "-", or "+") and pass the
remainder of the line to the whitespace checker.

Usually we do not pass a context line to the whitespace error checker,
but when we are correcting errors, we do.  This "remove the first
byte and send the remainder" strategy of checking a line ended up
sending a zero-length string to the whitespace checker when seeing a
new-style empty context line, which caused the whitespace checker to
say "ah, you do not even have a newline at the end!", leading to an
"incomplete line" in the middle of the patch!

Fix this by pretending that we got a traditional empty context line
when we drive the whitespace checker.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>apply: report input location in binary and garbage patch errors</title>
<updated>2026-03-17T18:08:32Z</updated>
<author>
<name>Jialong Wang</name>
<email>jerrywang183@yahoo.com</email>
</author>
<published>2026-03-17T16:23:21Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=2ef795b027c10f5e253151106a6fb4265552cc04'/>
<id>urn:sha1:2ef795b027c10f5e253151106a6fb4265552cc04</id>
<content type='text'>
Several binary parsing paths in apply.c still report only line
numbers. When more than one patch input is fed to a single
invocation, that does not tell the user which input the line belongs
to.

Report the patch input location for corrupt and unrecognized binary
patches, as well as the "patch with only garbage" case, and update
the related tests.

Signed-off-by: Jialong Wang &lt;jerrywang183@yahoo.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>apply: report input location in header parsing errors</title>
<updated>2026-03-17T18:08:24Z</updated>
<author>
<name>Jialong Wang</name>
<email>jerrywang183@yahoo.com</email>
</author>
<published>2026-03-17T16:23:20Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=838c0ba5004b37009d8d2649ed1be7b77770c2f0'/>
<id>urn:sha1:838c0ba5004b37009d8d2649ed1be7b77770c2f0</id>
<content type='text'>
Several header parsing errors in apply.c still report only line
numbers. When applying more than one input, that does not tell the
user which input the line belongs to.

Report the patch input location for these header parsing errors, and
update the related tests.

While touching parse_git_diff_header(), update the helper state to use
the current header line when reporting these errors.

Signed-off-by: Jialong Wang &lt;jerrywang183@yahoo.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>apply: report the location of corrupt patches</title>
<updated>2026-03-17T18:08:24Z</updated>
<author>
<name>Jialong Wang</name>
<email>jerrywang183@yahoo.com</email>
</author>
<published>2026-03-17T16:23:19Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c5e15c9a58c0b32ec8be3ae96434834124de175e'/>
<id>urn:sha1:c5e15c9a58c0b32ec8be3ae96434834124de175e</id>
<content type='text'>
When parsing a corrupt patch, git apply reports only the line number.
That does not tell the user which input the line number refers to.

Include the patch input path in the error message so the reported
location is easier to use.

Reset the line number for each patch input so the reported location stays
correct when multiple input files are provided.

Add tests for file input, standard input, multiple patch inputs, and
existing binary-diff corrupt patch cases.

Signed-off-by: Jialong Wang &lt;jerrywang183@yahoo.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>apply.c: fix -p argument parsing</title>
<updated>2026-03-16T19:54:47Z</updated>
<author>
<name>Mirko Faina</name>
<email>mroik@delayed.space</email>
</author>
<published>2026-03-16T00:51:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d05d84c5f507e8b973982e9cf3a27a07cd94fcb8'/>
<id>urn:sha1:d05d84c5f507e8b973982e9cf3a27a07cd94fcb8</id>
<content type='text'>
"git apply" has an option -p that takes an integer as its argument.
Unfortunately the function apply_option_parse_p() in charge of parsing
this argument uses atoi() to convert from string to integer, which
allows a non-digit after the number (e.g. "1q") to be silently ignored.
As a consequence, an argument that does not begin with a digit silently
becomes a zero. Despite this command working fine when a non-positive
argument is passed, it might be useful for the end user to know that
their input contains non-digits that might've been unintended.

Replace atoi() with strtol_i() to catch malformed inputs.

Signed-off-by: Mirko Faina &lt;mroik@delayed.space&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jr/apply-directory-normalize'</title>
<updated>2026-03-04T18:53:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-04T18:53:01Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=1ebfc2171310ed5ca2bcd8c1255d45f03e56dda7'/>
<id>urn:sha1:1ebfc2171310ed5ca2bcd8c1255d45f03e56dda7</id>
<content type='text'>
"git apply --directory=./un/../normalized/path" now normalizes the
given path before using it.

* jr/apply-directory-normalize:
  apply: normalize path in --directory argument
</content>
</entry>
<entry>
<title>Merge branch 'jc/whitespace-incomplete-line'</title>
<updated>2026-02-27T23:11:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-02-27T23:11:52Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=0f0a57e1e3df3a41c1ccc6dcbd4642b83e977346'/>
<id>urn:sha1:0f0a57e1e3df3a41c1ccc6dcbd4642b83e977346</id>
<content type='text'>
It does not make much sense to apply the "incomplete-line"
whitespace rule to symbolic links, whose contents almost always
lack the final newline.  "git apply" and "git diff" are now taught
to exclude them for a change to symbolic links.

* jc/whitespace-incomplete-line:
  whitespace: symbolic links usually lack LF at the end
</content>
</entry>
</feed>
