<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/xdiff, branch seen</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=seen</id>
<link rel='self' href='https://git.shady.money/git/atom?h=seen'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-05-17T13:58:45Z</updated>
<entry>
<title>Merge branch 'mm/diff-U-takes-no-negative-values' into jch</title>
<updated>2026-05-17T13:58:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-17T13:58:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=888c90a7fa566c89b1601c0feb328f0fbdef6174'/>
<id>urn:sha1:888c90a7fa566c89b1601c0feb328f0fbdef6174</id>
<content type='text'>
The command line parser for "git diff" learned a few options take
only non-negative integers.

* mm/diff-U-takes-no-negative-values:
  parse-options: clarify what "negated" means for PARSE_OPT_NONEG
  xdiff: guard against negative context lengths
  diff: reject negative values for -U/--unified
  diff: reject negative values for --inter-hunk-context
</content>
</entry>
<entry>
<title>Merge branch 'pw/xdiff-shrink-memory-consumption' into jch</title>
<updated>2026-05-17T13:58:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-17T13:58:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=305a4752bca9bd7a40a0b129b18c99e68e784f44'/>
<id>urn:sha1:305a4752bca9bd7a40a0b129b18c99e68e784f44</id>
<content type='text'>
Shrink wasted memory in Myers diff that does not account for common
prefix and suffix removal.

* pw/xdiff-shrink-memory-consumption:
  xdiff: reduce the size of array
  xprepare: simplify error handling
  xdiff: cleanup xdl_clean_mmatch()
  xdiff: reduce size of action arrays
</content>
</entry>
<entry>
<title>Merge branch 'en/xdiff-cleanup-3' into jch</title>
<updated>2026-05-17T13:58:38Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-17T13:58:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2216b42e90059140c62b739455437c04de827c25'/>
<id>urn:sha1:2216b42e90059140c62b739455437c04de827c25</id>
<content type='text'>
Preparation of the xdiff/ codebase to work with Rust.

* en/xdiff-cleanup-3:
  xdiff/xdl_cleanup_records: make execution of action easier to follow
  xdiff/xdl_cleanup_records: make setting action easier to follow
  xdiff/xdl_cleanup_records: make limits more clear
  xdiff/xdl_cleanup_records: use unambiguous types
  xdiff: use unambiguous types in xdl_bogo_sqrt()
  xdiff/xdl_cleanup_records: delete local recs pointer
</content>
</entry>
<entry>
<title>xdiff: guard against negative context lengths</title>
<updated>2026-05-13T01:13:26Z</updated>
<author>
<name>Michael Montalbo</name>
<email>mmontalbo@gmail.com</email>
</author>
<published>2026-05-12T18:10:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4517e4ca104ca93b51b4acf4d2c62e9325bbb623'/>
<id>urn:sha1:4517e4ca104ca93b51b4acf4d2c62e9325bbb623</id>
<content type='text'>
The xdemitconf_t fields ctxlen and interhunkctxlen are typed as long
(signed), but negative values are not meaningful for context line
counts. Unlike the diff_options fields changed in the previous two
commits, these cannot be converted to unsigned because the xdiff
arithmetic relies on signed subtraction:

    s1 = XDL_MAX(xch-&gt;i1 - xecfg-&gt;ctxlen, 0);

If ctxlen were unsigned long, the signed operand would be implicitly
converted to unsigned, and the subtraction would wrap to a large
positive value when i1 &lt; ctxlen, defeating the XDL_MAX clamp. The
signed type is required for correct context-window calculations.

The previous two commits reject negative values at the parse layer
for --inter-hunk-context and -U/--unified, so negative values should
no longer reach xdiff in normal use. Add BUG() guards at the top of
xdl_get_hunk() as defense in depth to catch programming errors in
current or future callers that bypass option parsing.

xdl_get_hunk() is called by both xdl_emit_diff() and
xdl_call_hunk_func(), so a single guard covers all xdiff consumers.

Signed-off-by: Michael Montalbo &lt;mmontalbo@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: reduce the size of array</title>
<updated>2026-05-05T07:20:06Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-05-04T14:06:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dca97e79bbf75f27602fe277344bfebebed82bb9'/>
<id>urn:sha1:dca97e79bbf75f27602fe277344bfebebed82bb9</id>
<content type='text'>
When the myers algorithm is selected the input files are pre-processed
to remove any common prefix and suffix and any lines that appear
in only one file. This requires a map to be created between the
lines that are processed by the myers algorithm and the lines in
the original file. That map does not include the common lines at the
beginning and end of the files but the array is allocated to be the
size of the whole file. Move the allocation into xdl_cleanup_records()
where the map is populated and we know how big it needs to be.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xprepare: simplify error handling</title>
<updated>2026-05-05T07:20:05Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-05-04T14:06:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c8eb18f58607057a812654bdfca3e6b47bd0ffe4'/>
<id>urn:sha1:c8eb18f58607057a812654bdfca3e6b47bd0ffe4</id>
<content type='text'>
If either of the two allocations fail we want to take the same action
so use a single if statement. This saves a few lines and makes it
easier for the next commit to add a couple more allocations.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: cleanup xdl_clean_mmatch()</title>
<updated>2026-05-05T07:20:05Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-05-04T14:06:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=53d13887b8581d46dffc1f4ee2622c977b65ecb5'/>
<id>urn:sha1:53d13887b8581d46dffc1f4ee2622c977b65ecb5</id>
<content type='text'>
Remove the "s" parameter as, since the last commit, this function
is always called with s == 0. Also change parameter "e" to expect a
length, rather than the index of the last line to simplify the caller.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>xdiff: reduce size of action arrays</title>
<updated>2026-05-05T07:20:05Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2026-05-04T14:06:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a81411253323208e1e8d3591247c27fefa8a2045'/>
<id>urn:sha1:a81411253323208e1e8d3591247c27fefa8a2045</id>
<content type='text'>
When the myers algorithm is selected the input files are pre-processed
to remove any common prefix and suffix. Then any lines that appear
only in one side of the diff are marked as changed and frequently
occurring lines are marked as changed if they are adjacent to a
changed line. This step requires a couple of temporary arrays. As as
the common prefix and suffix have already been removed, the arrays
only need to be big enough to hold the lines between them, not the
whole file. Reduce the size of the arrays and adjust the loops that
use them accordingly while taking care to keep indexing the arrays
in xdfile_t with absolute line numbers.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'en/xdiff-cleanup-3' into pw/xdiff-shrink-memory-consumption</title>
<updated>2026-05-05T07:19:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-05-05T07:19:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bfd057b2dd5226f0eedbf1ad47506f8ed33a715a'/>
<id>urn:sha1:bfd057b2dd5226f0eedbf1ad47506f8ed33a715a</id>
<content type='text'>
* en/xdiff-cleanup-3:
  xdiff/xdl_cleanup_records: make execution of action easier to follow
  xdiff/xdl_cleanup_records: make setting action easier to follow
  xdiff/xdl_cleanup_records: make limits more clear
  xdiff/xdl_cleanup_records: use unambiguous types
  xdiff: use unambiguous types in xdl_bogo_sqrt()
  xdiff/xdl_cleanup_records: delete local recs pointer
</content>
</entry>
<entry>
<title>xdiff/xdl_cleanup_records: make execution of action easier to follow</title>
<updated>2026-04-30T00:16:51Z</updated>
<author>
<name>Ezekiel Newren</name>
<email>ezekielnewren@gmail.com</email>
</author>
<published>2026-04-29T22:08:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f87808b7014cf06db4a7e19b193cf9aa7e965ebc'/>
<id>urn:sha1:f87808b7014cf06db4a7e19b193cf9aa7e965ebc</id>
<content type='text'>
Helped-by: Phillip Wood
Signed-off-by: Ezekiel Newren &lt;ezekielnewren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
