<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff.h, 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>2025-12-14T08:04:36Z</updated>
<entry>
<title>Merge branch 'rs/diff-index-find-copies-harder-optim'</title>
<updated>2025-12-14T08:04:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-12-14T08:04:36Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=84ca5a2457757e8997ddcaa64e8c26372359965c'/>
<id>urn:sha1:84ca5a2457757e8997ddcaa64e8c26372359965c</id>
<content type='text'>
Halve the memory consumed by artificial filepairs created during
"git diff --find-copioes-harder", also making the operation run
faster.

* rs/diff-index-find-copies-harder-optim:
  diff-index: don't queue unchanged filepairs with diff_change()
</content>
</entry>
<entry>
<title>Merge branch 'jc/whitespace-incomplete-line'</title>
<updated>2025-12-01T02:31:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-12-01T02:31:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=3b212a83feea0962d437a3d5883cdd635403fe3c'/>
<id>urn:sha1:3b212a83feea0962d437a3d5883cdd635403fe3c</id>
<content type='text'>
Both "git apply" and "git diff" learn a new whitespace error class,
"incomplete-line".

* jc/whitespace-incomplete-line:
  attr: enable incomplete-line whitespace error for this project
  diff: highlight and error out on incomplete lines
  apply: check and fix incomplete lines
  whitespace: allocate a few more bits and define WS_INCOMPLETE_LINE
  apply: revamp the parsing of incomplete lines
  diff: update the way rewrite diff handles incomplete lines
  diff: call emit_callback ecbdata everywhere
  diff: refactor output of incomplete line
  diff: keep track of the type of the last line seen
  diff: correct suppress_blank_empty hack
  diff: emit_line_ws_markup() if/else style fix
  whitespace: correct bit assignment comments
</content>
</entry>
<entry>
<title>diff-index: don't queue unchanged filepairs with diff_change()</title>
<updated>2025-11-30T17:58:53Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-11-30T11:47:17Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=38f88051dae6ddb2f1cdb9c7415d4ba6caef04af'/>
<id>urn:sha1:38f88051dae6ddb2f1cdb9c7415d4ba6caef04af</id>
<content type='text'>
diff_cache() queues unchanged filepairs if the flag find_copies_harder
is set, and uses diff_change() for that.  This function allocates a
filespec for each side, does a few other things that are unnecessary for
unchanged filepairs and always sets the diff_flag has_changes, which is
simply misleading in this case.

Add a new streamlined function for queuing unchanged filepairs and
use it in show_modified(), which is called by diff_cache() via
oneway_diff() and do_oneway_diff().  It allocates only a single filespec
for each filepair and uses it twice with reference counting.  This has a
measurable effect if there are a lot of them, like in the Linux repo:

Benchmark 1: ./git_v2.52.0 -C ../linux diff --cached --find-copies-harder
  Time (mean ± σ):      31.8 ms ±   0.2 ms    [User: 24.2 ms, System: 6.3 ms]
  Range (min … max):    31.5 ms …  32.3 ms    85 runs

Benchmark 2: ./git -C ../linux diff --cached --find-copies-harder
  Time (mean ± σ):      23.9 ms ±   0.2 ms    [User: 18.1 ms, System: 4.6 ms]
  Range (min … max):    23.5 ms …  24.4 ms    111 runs

Summary
  ./git -C ../linux diff --cached --find-copies-harder ran
    1.33 ± 0.01 times faster than ./git_v2.52.0 -C ../linux diff --cached --find-copies-harder

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>whitespace: allocate a few more bits and define WS_INCOMPLETE_LINE</title>
<updated>2025-11-12T22:04:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-11-12T22:02:55Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a675104c399d242dd3ff5a0823fcd770563cf60f'/>
<id>urn:sha1:a675104c399d242dd3ff5a0823fcd770563cf60f</id>
<content type='text'>
Reserve a few more bits in the diff flags word to be used for future
whitespace rules.  Add WS_INCOMPLETE_LINE without implementing the
behaviour (yet).

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>whitespace: correct bit assignment comments</title>
<updated>2025-11-12T22:04:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-11-12T22:02:47Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=8d4725e48ef29bd857e21e689411878b6eb4df92'/>
<id>urn:sha1:8d4725e48ef29bd857e21e689411878b6eb4df92</id>
<content type='text'>
A comment in diff.c claimed that bits up to 12th (counting from 0th)
are whitespace rules, and 13th thru 15th are for new/old/context,
but it turns out it was miscounting.  Correct them, and clarify
where the whitespace rule bits come from in the comment.  Extend bit
assignment comments to cover bits used for color-moved, which
weren't described.

Also update the way these bit constants are defined to use (1 &lt;&lt; N)
notation, instead of octal constants, as it tends to make it easier
to notice a breakage like this.

Sprinkle a few blank lines between logically distinct groups of CPP
macro definitions to make them easier to read.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: replace diff_options.dry_run flag with NULL file</title>
<updated>2025-10-24T17:15:22Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-10-24T17:08:53Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=b2b5ad514d62ba26b3cfa65104d81c2d19552789'/>
<id>urn:sha1:b2b5ad514d62ba26b3cfa65104d81c2d19552789</id>
<content type='text'>
We introduced a dry_run flag to diff_options in b55e6d36eb (diff: ensure
consistent diff behavior with ignore options, 2025-08-08), with the idea
that the lower-level diff code could skip output when it is set.

As we saw with the bugs fixed by 3ed5d8bd73 (diff: stop output garbled
message in dry run mode, 2025-10-20), it is easy to miss spots. In the
end, we located all of them by checking where diff_options.file is used.

That suggests another possible approach: we can replace the dry_run
boolean with a NULL pointer for "file", as we know that using "file" in
dry_run mode would always be an error. This turns any missed spots from
producing extra output[1] into a segfault. Which is less forgiving, but
that is the point: this is indicative of a programming error, and
complaining loudly and immediately is good.

[1] We protect ourselves against garbled output as a separate step,
    courtesy of 623f7af284 (diff: restore redirection to /dev/null for
    diff_from_contents, 2025-10-17). So in that sense this patch can
    only introduce user-visible errors (since any "bugs" were going to
    /dev/null before), but the idea is to catch them rather than quietly
    send garbage to /dev/null.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tc/last-modified-recursive-fix'</title>
<updated>2025-09-29T18:40:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-09-29T18:40:35Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=d5518d52b23dc4d7d001b0725c5faab4063a3598'/>
<id>urn:sha1:d5518d52b23dc4d7d001b0725c5faab4063a3598</id>
<content type='text'>
"git last-modified" operating in non-recursive mode used to trigger
a BUG(), which has been corrected.

* tc/last-modified-recursive-fix:
  last-modified: fix bug when some paths remain unhandled
</content>
</entry>
<entry>
<title>Merge branch 'jk/color-variable-fixes'</title>
<updated>2025-09-29T18:40:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-09-29T18:40:35Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=a89fa2fff2e2e5c13df0caccd913427b5c98a4b4'/>
<id>urn:sha1:a89fa2fff2e2e5c13df0caccd913427b5c98a4b4</id>
<content type='text'>
Some places in the code confused a variable that is *not* a boolean
to enable color but is an enum that records what the user requested
to do about color.  A couple of bugs of this sort have been fixed,
while the code has been cleaned up to prevent similar bugs in the
future.

* jk/color-variable-fixes:
  config: store want_color() result in a separate bool
  add-interactive: retain colorbool values longer
  color: return bool from want_color()
  color: use git_colorbool enum type to store colorbools
  pretty: use format_commit_context.auto_color as colorbool
  diff: stop passing ecbdata-&gt;use_color as boolean
  diff: pass o-&gt;use_color directly to fill_metainfo()
  diff: don't use diff_options.use_color as a strict bool
  diff: simplify color_moved check when flushing
  grep: don't treat grep_opt.color as a strict bool
  color: return enum from git_config_colorbool()
  color: use GIT_COLOR_* instead of numeric constants
</content>
</entry>
<entry>
<title>last-modified: fix bug when some paths remain unhandled</title>
<updated>2025-09-18T15:00:41Z</updated>
<author>
<name>Toon Claes</name>
<email>toon@iotcl.com</email>
</author>
<published>2025-09-18T08:00:08Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e6c06e87a255995d2e7ead2b8e49e46e29a724fb'/>
<id>urn:sha1:e6c06e87a255995d2e7ead2b8e49e46e29a724fb</id>
<content type='text'>
The recently introduced new subcommand git-last-modified(1) runs into an
error in some scenarios. It then would exit with the message:

    BUG: paths remaining beyond boundary in last-modified

This seems to happens for example when criss-cross merges are involved.
In that scenario, the function diff_tree_combined() gets called.

The function diff_tree_combined() copies the `struct diff_options` from
the input `struct rev_info` to override some flags. One flag is
`recursive`, which is always set to 1. This has been the case since the
inception of this function in af3feefa1d (diff-tree -c: show a merge
commit a bit more sensibly., 2006-01-24).

This behavior is incompatible with git-last-modified(1), when called
non-recursive (which is the default).

The last-modified machinery uses a hashmap for all the paths it wants to
get the last-modified commit for. Through log_tree_commit() the callback
mark_path() is called. The diff machinery uses diff_tree_combined()
internally, and due to it's recursive behavior the callback receives
entries inside subtrees, but not the subtree entries themselves. So a
directory is never expelled from the hashmap, and the BUG() statement
gets hit.

Because there are many callers calling into diff_tree_combined(), both
directly and indirectly, we cannot simply change it's behavior.

Instead, add a flag `no_recursive_diff_tree_combined` which supresses
the behavior of diff_tree_combined() to override `recursive` and set
this flag in builtin/last-modified.c.

Signed-off-by: Toon Claes &lt;toon@iotcl.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>color: use git_colorbool enum type to store colorbools</title>
<updated>2025-09-17T00:59:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-09-16T23:13:59Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=e9330ae4b820147c98e723399e9438c8bee60a80'/>
<id>urn:sha1:e9330ae4b820147c98e723399e9438c8bee60a80</id>
<content type='text'>
We traditionally used "int" to store and pass around the values defined
by "enum git_colorbool" (which were originally just #define macros).
Using an int doesn't produce incorrect results, but using the actual
enum makes the intent of the code more clear.

It would be nice if the compiler could catch cases where we used the
enum and an int interchangeably, since it's very easy to accidentally
check the boolean true/false of a colorbool like:

  if (branch_use_color)

This is wrong because GIT_COLOR_UNKNOWN and GIT_COLOR_AUTO evaluate to
true in C, even though we may ultimately decide not to use color. But C
is pretty happy to convert between ints and enums (even with various
-Wenum-* warnings). So this sadly doesn't protect us from such mistakes,
but it hopefully does make the code easier to read.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
