<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.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:27Z</updated>
<entry>
<title>Merge branch 'mm/line-log-use-standard-diff-output'</title>
<updated>2026-04-07T21:59:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-04-07T21:59:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=1678b7de977043f31242d2029259797eee620236'/>
<id>urn:sha1:1678b7de977043f31242d2029259797eee620236</id>
<content type='text'>
The way the "git log -L&lt;range&gt;:&lt;file&gt;" feature is bolted onto the
log/diff machinery is being reworked a bit to make the feature
compatible with more diff options, like -S/G.

* mm/line-log-use-standard-diff-output:
  doc: note that -L supports patch formatting and pickaxe options
  t4211: add tests for -L with standard diff options
  line-log: route -L output through the standard diff pipeline
  line-log: fix crash when combined with pickaxe options
</content>
</entry>
<entry>
<title>line-log: route -L output through the standard diff pipeline</title>
<updated>2026-03-17T04:05:42Z</updated>
<author>
<name>Michael Montalbo</name>
<email>mmontalbo@gmail.com</email>
</author>
<published>2026-03-17T02:21:33Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=86e986f166d207e1f4b80062c2befb4f94c191c4'/>
<id>urn:sha1:86e986f166d207e1f4b80062c2befb4f94c191c4</id>
<content type='text'>
`git log -L` has always bypassed the standard diff pipeline.
`dump_diff_hacky()` in line-log.c hand-rolls its own diff headers and
hunk output, which means most diff formatting options are silently
ignored.  A NEEDSWORK comment has acknowledged this since the feature
was introduced:

    /*
     * NEEDSWORK: manually building a diff here is not the Right
     * Thing(tm).  log -L should be built into the diff pipeline.
     */

Remove `dump_diff_hacky()` and its helpers and route -L output through
`builtin_diff()` / `fn_out_consume()`, the same path used by `git diff`
and `git log -p`.  The mechanism is a pair of callback wrappers that sit
between `xdi_diff_outf()` and `fn_out_consume()`, filtering xdiff's
output to only the tracked line ranges.  To ensure xdiff emits all lines
within each range as context, the context length is inflated to span the
largest range.

Wire up the `-L` implies `--patch` default in revision setup rather
than forcing it at output time, so `line_log_print()` is just
`diffcore_std()` + `diff_flush()` with no format save/restore.
Rename detection is a no-op since pairs are already resolved during
the history walk in `queue_diffs()`, but running `diffcore_std()`
means `-S`/`-G` (pickaxe), `--orderfile`, and `--diff-filter` now
work with `-L`, and `diff_resolve_rename_copy()` sets pair statuses
correctly without manual assignment.

Switch `diff_filepair_dup()` from `xmalloc` to `xcalloc` so that new
fields (including `line_ranges`) are zero-initialized by default.

As a result, diff formatting options that were previously silently
ignored (e.g. --word-diff, --no-prefix, -w, --color-moved) now work
with -L, and output gains `index` lines, `new file mode` headers, and
funcname context in `@@` headers.  This is a user-visible output change:
tools that parse -L output may need to handle the additional header
lines.

The context-length inflation means xdiff may process more output than
needed for very wide line ranges, but benchmarks on files up to 7800
lines show no measurable regression.

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>Merge branch 'mm/diff-no-index-find-object'</title>
<updated>2026-03-10T21:23:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-10T21:23:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=015cf12578691d77638c7b99f27c15f4d73446e4'/>
<id>urn:sha1:015cf12578691d77638c7b99f27c15f4d73446e4</id>
<content type='text'>
"git diff --no-index --find-object=&lt;object-name&gt;" outside a
repository of course wouldn't be able to find the object and died
while parsing the command line, which is made to die in a bit more
user-friendly way.

* mm/diff-no-index-find-object:
  diff: fix crash with --find-object outside repository
</content>
</entry>
<entry>
<title>Merge branch 'lp/diff-stat-utf8-display-width-fix'</title>
<updated>2026-03-09T21:36:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-03-09T21:36:55Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e757df82af5e9283fec2ff54d1e0eec2662c623c'/>
<id>urn:sha1:e757df82af5e9283fec2ff54d1e0eec2662c623c</id>
<content type='text'>
"git log --graph --stat" did not count the display width of colored
graph part of its own output correctly, which has been corrected.

* lp/diff-stat-utf8-display-width-fix:
  t4052: test for diffstat width when prefix contains ANSI escape codes
  diff: handle ANSI escape codes in prefix when calculating diffstat width
</content>
</entry>
<entry>
<title>Merge branch 'en/merge-ort-almost-wo-the-repository'</title>
<updated>2026-03-04T18:53:02Z</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=ca1a1a75c185fc01ad858268b4431e835933e2eb'/>
<id>urn:sha1:ca1a1a75c185fc01ad858268b4431e835933e2eb</id>
<content type='text'>
Mark the marge-ort codebase to prevent more uses of the_repository
from getting added.

* en/merge-ort-almost-wo-the-repository:
  replay: prevent the_repository from coming back
  merge-ort: prevent the_repository from coming back
  merge-ort: replace the_hash_algo with opt-&gt;repo-&gt;hash_algo
  merge-ort: replace the_repository with opt-&gt;repo
  merge-ort: pass repository to write_tree()
  merge,diff: remove the_repository check before prefetching blobs
</content>
</entry>
<entry>
<title>diff: fix crash with --find-object outside repository</title>
<updated>2026-03-02T16:29:48Z</updated>
<author>
<name>Michael Montalbo</name>
<email>mmontalbo@gmail.com</email>
</author>
<published>2026-02-28T20:31:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=b0ddc7947cc6f0a077543204a96710c53daa48a5'/>
<id>urn:sha1:b0ddc7947cc6f0a077543204a96710c53daa48a5</id>
<content type='text'>
When "git diff --find-object=&lt;oid&gt;" is run outside a git repository,
the option parsing callback eagerly resolves the OID via
repo_get_oid(), which reaches get_main_ref_store() and hits a BUG()
assertion because no repository has been set up.

Check startup_info-&gt;have_repository before attempting to resolve the
OID, and return a user-friendly error instead.

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>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>
<entry>
<title>diff: handle ANSI escape codes in prefix when calculating diffstat width</title>
<updated>2026-02-27T21:59:22Z</updated>
<author>
<name>LorenzoPegorari</name>
<email>lorenzo.pegorari2002@gmail.com</email>
</author>
<published>2026-02-27T21:45:19Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=1a9df8de368cbebd881336f64e424422f3dbb993'/>
<id>urn:sha1:1a9df8de368cbebd881336f64e424422f3dbb993</id>
<content type='text'>
The diffstat width is calculated by taking the terminal width and
incorrectly subtracting the `strlen()` of `line_prefix`, instead of the
actual display width of `line_prefix`, which may contain ANSI escape
codes (e.g., ANSI-colored strings in `log --graph --stat`).

Utilize the display width instead, obtained via `utf8_strnwidth()` with
the flag `skip_ansi`.

Signed-off-by: LorenzoPegorari &lt;lorenzo.pegorari2002@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>merge,diff: remove the_repository check before prefetching blobs</title>
<updated>2026-02-22T02:34:06Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2026-02-21T23:59:48Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=84325f0730801b7638f1152ea3553530452d5c3b'/>
<id>urn:sha1:84325f0730801b7638f1152ea3553530452d5c3b</id>
<content type='text'>
Prefetching of blobs from promisor remotes was added to diff in
7fbbcb21b162 (diff: batch fetching of missing blobs, 2019-04-05).  In
that commit,

  https://lore.kernel.org/git/20190405170934.20441-1-jonathantanmy@google.com/

was squashed into

  https://lore.kernel.org/git/44de02e584f449481e6fb00cf35d74adf0192e9d.1553895166.git.jonathantanmy@google.com/

without the extra explanation about the squashed changes being added to
the commit message; in particular, this explanation from that first link
is absent:

&gt; Also, prefetch only if the repository being diffed is the_repository
&gt; (because we do not support lazy fetching for any other repository
&gt;  anyway).

Then, later, this checking was spread from diff.c to diffcore-rename.c
and diffcore-break.c by 95acf11a3dc3 (diff: restrict when prefetching
occurs, 2020-04-07) and then further split in d331dd3b0c82
(diffcore-rename: allow different missing_object_cb functions,
2021-06-22).  I also copied the logic from prefetching blobs from
diff.c to merge-ort.c in 2bff554b23e8 (merge-ort: add prefetching for
content merges, 2021-06-22).

The reason for all these checks was noted above -- we only supported
lazy fetching for the_repository.  However, that changed with
ef830cc43412 (promisor-remote: teach lazy-fetch in any repo,
2021-06-17), so these checks are now unnecessary.  Remove them.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'cf/c23-const-preserving-strchr-updates-0'</title>
<updated>2026-02-13T21:39:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2026-02-13T21:39:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=7855effc952777f2fac284e4461743cf5aa20ee6'/>
<id>urn:sha1:7855effc952777f2fac284e4461743cf5aa20ee6</id>
<content type='text'>
ISO C23 redefines strchr and friends that tradiotionally took
a const pointer and returned a non-const pointer derived from it to
preserve constness (i.e., if you ask for a substring in a const
string, you get a const pointer to the substring).  Update code
paths that used non-const pointer to receive their results that did
not have to be non-const to adjust.

* cf/c23-const-preserving-strchr-updates-0:
  gpg-interface: remove an unnecessary NULL initialization
  global: constify some pointers that are not written to
</content>
</entry>
</feed>
