<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/contrib/diff-highlight, branch v2.48.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.48.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.48.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-10-23T20:16:36Z</updated>
<entry>
<title>Require Perl 5.26.0</title>
<updated>2024-10-23T20:16:36Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2024-10-23T00:45:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=702d8c1f3b5377a64670b0f22add157b0bfc33dd'/>
<id>urn:sha1:702d8c1f3b5377a64670b0f22add157b0bfc33dd</id>
<content type='text'>
Our platform support policy states that we require "versions of
dependencies which are generally accepted as stable and supportable,
e.g., in line with the version used by other long-term-support
distributions".  Of Debian, Ubuntu, RHEL, and SLES, the four most common
distributions that provide LTS versions, the version with mainstream
long-term security support with the oldest Perl is 5.26.0 in SLES 15.6.

This is a major upgrade, since Perl 5.8.1, according to the Perl
documentation, was released in September of 2003.  It brings a lot of
new features that we can choose to use, such as s///r to return the
modified string, the postderef functionality, and subroutine signatures,
although the latter was still considered experimental until 5.36.

This change was made with the following one-liner, which intentionally
excludes modifying the vendored modules we include to avoid conflicts:

    git grep -l 'use 5.008001' | grep -v 'LoadCPAN/' | xargs perl -pi -e 's/use 5.008001/require v5.26/'

Use require instead of use to avoid changing the behavior as the latter
enables features and the former does not.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
</content>
</entry>
<entry>
<title>perl: bump the required Perl version to 5.8.1 from 5.8.0</title>
<updated>2023-11-16T22:26:32Z</updated>
<author>
<name>Todd Zullinger</name>
<email>tmz@pobox.com</email>
</author>
<published>2023-11-16T19:30:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d13a73e383076636534e10ba799af0c9a2b85357'/>
<id>urn:sha1:d13a73e383076636534e10ba799af0c9a2b85357</id>
<content type='text'>
The following commit will make use of a Getopt::Long feature which is
only present in Perl &gt;= 5.8.1.  Document that as the minimum version we
support.

Many of our Perl scripts will continue to run with 5.8.0 but this change
allows us to adjust them as needed without breaking any promises to our
users.

The Perl requirement was last changed in d48b284183 (perl: bump the
required Perl version to 5.8 from 5.6.[21], 2010-09-24).  At that time,
5.8.0 was 8 years old.  It is now over 21 years old.

Signed-off-by: Todd Zullinger &lt;tmz@pobox.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: correctly match blank lines for flush</title>
<updated>2020-09-22T05:33:28Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-09-22T05:00:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=579789dbced8f9aee987fc4d609f5f92d32f9d26'/>
<id>urn:sha1:579789dbced8f9aee987fc4d609f5f92d32f9d26</id>
<content type='text'>
We try to flush the output from diff-highlight whenever we see a blank
line. That lets you see the output for each commit as soon as it is
generated, even if Git is still chugging away at a diff, or traversing
to find the next commit.

However, our "blank line" match checks length($_). That won't ever be
true, because we haven't chomped the line ending. As a result, we never
flush. Instead, let's use a simple regex which handles line endings in
with the end-of-line marker.

This has been broken since the initial version in 927a13fe87 (contrib:
add diff highlight script, 2011-10-18). Probably nobody noticed because:

  - most output is big enough, or comes fast enough, that it flushes
    anyway. And it can be difficult to notice the difference between
    "show a commit, then pause" and "pause, then show two commits". I
    only noticed because I was viewing "git log" output on a repo with a
    very slow textconv filter.

  - if stdout is going to the terminal (and not another pager like
    less), then the flush isn't necessary. So any manual testing would
    show it appearing to work.

You can easily see the difference with something like:

  echo '* diff=slow' &gt;&gt;.gitattributes
  git -c diff.slow.textconv='sleep 1; cat' \
      -c pager.log='diff-highlight | less' \
      log -p

That should generate one commit every second or so (more if it touches
multiple files), but without this patch it waits for many seconds before
generating several pages of output.

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>diff-highlight: fix a whitespace nit</title>
<updated>2019-10-15T05:08:37Z</updated>
<author>
<name>Norman Rasmussen</name>
<email>norman@rasmussen.co.za</email>
</author>
<published>2019-10-15T03:31:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b3c79f6c9cdd3fc6f5231e2d8c53ee732cfc771'/>
<id>urn:sha1:3b3c79f6c9cdd3fc6f5231e2d8c53ee732cfc771</id>
<content type='text'>
This changes the indent from
  "&lt;tab&gt;&lt;sp&gt;&lt;sp&gt;&lt;sp&gt;&lt;sp&gt;&lt;sp&gt;&lt;sp&gt;&lt;sp&gt;&lt;sp&gt;"
to
  "&lt;tab&gt;&lt;tab&gt;"
so that the statement lines up with the rest of the block.

Signed-off-by: Norman Rasmussen &lt;norman@rasmussen.co.za&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: use correct /dev/null for UNIX and Windows</title>
<updated>2019-05-09T03:18:44Z</updated>
<author>
<name>Chris. Webster</name>
<email>chris@webstech.net</email>
</author>
<published>2018-10-31T14:58:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6804ba3a58ff2999533af28ca5af3901e30fd1f2'/>
<id>urn:sha1:6804ba3a58ff2999533af28ca5af3901e30fd1f2</id>
<content type='text'>
Use File::Spec-&gt;devnull() for output redirection to avoid messages
when Windows version of Perl is first in path.  The message 'The
system cannot find the path specified.' is displayed each time git is
run to get colors.

Signed-off-by: Chris. Webster &lt;chris@webstech.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff-highlight: detect --graph by indent</title>
<updated>2018-03-21T17:24:19Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-03-21T05:59:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4551fbba141e0b2e4d16830f76f784e9c960bdf8'/>
<id>urn:sha1:4551fbba141e0b2e4d16830f76f784e9c960bdf8</id>
<content type='text'>
This patch fixes a corner case where diff-highlight may
scramble some diffs when combined with --graph.

Commit 7e4ffb4c17 (diff-highlight: add support for --graph
output, 2016-08-29) taught diff-highlight to skip past the
graph characters at the start of each line with this regex:

  ($COLOR?\|$COLOR?\s+)*

I.e., any series of pipes separated by and followed by
arbitrary whitespace.  We need to match more than just a
single space because the commit in question may be indented
to accommodate other parts of the graph drawing. E.g.:

 * commit 1234abcd
 | ...
 | diff --git ...

has only a single space, but for the last commit before a
fork:

 | | |
 | * | commit 1234abcd
 | |/  ...
 | |   diff --git

the diff lines have more spaces between the pipes and the
start of the diff.

However, when we soak up all of those spaces with the
$GRAPH regex, we may accidentally include the leading space
for a context line. That means we may consider the actual
contents of a context line as part of the diff syntax. In
other words, something like this:

   normal context line
  -old line
  +new line
   -this is a context line with a leading dash

would cause us to see that final context line as a removal
line, and we'd end up showing the hunk in the wrong order:

  normal context line
  -old line
   -this is a context line with a leading dash
  +new line

Instead, let's a be a little more clever about parsing the
graph. We'll look for the actual "*" line that marks the
start of a commit, and record the indentation we see there.
Then we can skip past that indentation when checking whether
the line is a hunk header, removal, addition, etc.

There is one tricky thing: the indentation in bytes may be
different for various lines of the graph due to coloring.
E.g., the "*" on a commit line is generally shown without
color, but on the actual diff lines, it will be replaced
with a colorized "|" character, adding several bytes. We
work around this here by counting "visible" bytes. This is
unfortunately a bit more expensive, making us about twice as
slow to handle --graph output. But since this is meant to be
used interactively anyway, it's tolerably fast (and the
non-graph case is unaffected).

One alternative would be to search for hunk header lines and
use their indentation (since they'd have the same colors as
the diff lines which follow). But that just opens up
different corner cases. If we see:

  | |    @@ 1,2 1,3 @@

we cannot know if this is a real diff that has been
indented due to the graph, or if it's a context line that
happens to look like a diff header. We can only be sure of
the indent on the "*" lines, since we know those don't
contain arbitrary data (technically the user could include a
bunch of extra indentation via --format, but that's rare
enough to disregard).

Reported-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
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>diff-highlight: use flush() helper consistently</title>
<updated>2018-03-21T17:24:19Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-03-21T05:56:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=009a81ed978e5dc81767cf1be6dc4ea38c112801'/>
<id>urn:sha1:009a81ed978e5dc81767cf1be6dc4ea38c112801</id>
<content type='text'>
The current flush() helper only shows the queued diff but
does not clear the queue. This is conceptually a bug, but it
works because we only call it once at the end of the
program.

Let's teach it to clear the queue, which will let us use it
in more places (one for now, but more in future patches).

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>diff-highlight: test graphs with --color</title>
<updated>2018-03-21T17:24:19Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-03-21T05:49:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fbcf99e4acd666e1c4ef4304b53d96caaf0ae3f8'/>
<id>urn:sha1:fbcf99e4acd666e1c4ef4304b53d96caaf0ae3f8</id>
<content type='text'>
Our tests send git's output directly to files or pipes, so
there will never be any color. Let's do at least one --color
test to make sure that we can handle this case (which we
currently can, but will be an easy thing to mess up when we
touch the graph code in a future patch).

We'll just cover the --graph case, since this is much more
complex than the earlier cases (i.e., if it manages to
highlight, then the non-graph case definitely would).

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>diff-highlight: test interleaved parallel lines of history</title>
<updated>2018-03-21T17:24:19Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-03-21T05:49:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7ce2f4ca0e35a987fb29d11ae06438a93fd48873'/>
<id>urn:sha1:7ce2f4ca0e35a987fb29d11ae06438a93fd48873</id>
<content type='text'>
The graph test in t9400 covers the case of two simultaneous
branches, but all of the commits during this time are on the
right-hand branch. So we test a graph structure like:

  | |
  | * commit ...
  | |

but we never see the reverse, a commit on the left-hand
branch:

  | |
  * | commit ...
  | |

Since this is an easy thing to get wrong when touching the
graph-matching code, let's cover it by adding one more
commit with its timestamp interleaved with the other branch.

Note that we need to pass --date-order to convince Git to
show it this way (since --topo-order tries to keep lines of
history separate).

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>diff-highlight: prefer "echo" to "cat" in tests</title>
<updated>2018-03-21T17:24:19Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-03-21T05:48:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e28ae5072f633d77c65817db7b3aeb07d531a8d9'/>
<id>urn:sha1:e28ae5072f633d77c65817db7b3aeb07d531a8d9</id>
<content type='text'>
We generate a bunch of one-line files whose contents match
their names, and then generate our commits by cat-ing those
files. Let's just echo the contents directly, which saves
some processes.

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