<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/Documentation/diff-options.txt, branch v2.21.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.21.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.21.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-01-29T20:47:53Z</updated>
<entry>
<title>Merge branch 'pw/diff-color-moved-ws-fix'</title>
<updated>2019-01-29T20:47:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-01-29T20:47:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=15b07cba0b60f0fc5dea0be0d68a355a8161476d'/>
<id>urn:sha1:15b07cba0b60f0fc5dea0be0d68a355a8161476d</id>
<content type='text'>
"git diff --color-moved-ws" updates.

* pw/diff-color-moved-ws-fix:
  diff --color-moved-ws: handle blank lines
  diff --color-moved-ws: modify allow-indentation-change
  diff --color-moved-ws: optimize allow-indentation-change
  diff --color-moved=zebra: be stricter with color alternation
  diff --color-moved-ws: fix false positives
  diff --color-moved-ws: demonstrate false positives
  diff: allow --no-color-moved-ws
  Use "whitespace" consistently
  diff: document --no-color-moved
</content>
</entry>
<entry>
<title>diff: allow --no-color-moved-ws</title>
<updated>2019-01-10T18:37:59Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-11-23T11:16:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b73bcbac4a9d8c76ccdda0f0ac4b122b8e96e4b7'/>
<id>urn:sha1:b73bcbac4a9d8c76ccdda0f0ac4b122b8e96e4b7</id>
<content type='text'>
Allow --no-color-moved-ws and --color-moved-ws=no to cancel any previous
--color-moved-ws option.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Reviewed-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Use "whitespace" consistently</title>
<updated>2019-01-10T18:37:42Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-11-23T11:16:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=748aa1aa34a316b8f26a3664f3fdcd273e1c5c39'/>
<id>urn:sha1:748aa1aa34a316b8f26a3664f3fdcd273e1c5c39</id>
<content type='text'>
Most of the messages and documentation use 'whitespace' rather than
'white space' or 'white spaces' convert to latter two to the former for
consistency.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Reviewed-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: document --no-color-moved</title>
<updated>2019-01-10T18:37:32Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-11-23T11:16:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fbafb7c682272e039e7aacbf8c0ef8de3c0eb157'/>
<id>urn:sha1:fbafb7c682272e039e7aacbf8c0ef8de3c0eb157</id>
<content type='text'>
Add documentation for --no-color-moved.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Reviewed-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>log -G: ignore binary files</title>
<updated>2018-12-26T22:59:37Z</updated>
<author>
<name>Thomas Braun</name>
<email>thomas.braun@virtuell-zuhause.de</email>
</author>
<published>2018-12-14T18:49:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e0e7cb8080cb4a0b3a24f288bf363fe517b49790'/>
<id>urn:sha1:e0e7cb8080cb4a0b3a24f288bf363fe517b49790</id>
<content type='text'>
The -G&lt;regex&gt; option of log looks for the differences whose patch text
contains added/removed lines that match regex.

Currently -G looks also into patches of binary files (which
according to [1]) is binary as well.

This has a couple of issues:

- It makes the pickaxe search slow. In a proprietary repository of the
  author with only ~5500 commits and a total .git size of ~300MB
  searching takes ~13 seconds

    $time git log -Gwave &gt; /dev/null

    real    0m13,241s
    user    0m12,596s
    sys     0m0,644s

  whereas when we ignore binary files with this patch it takes ~4s

    $time ~/devel/git/git log -Gwave &gt; /dev/null

    real    0m3,713s
    user    0m3,608s
    sys     0m0,105s

  which is a speedup of more than fourfold.

- The internally used algorithm for generating patch text is based on
  xdiff and its states in [1]

  &gt; The output format of the binary patch file is proprietary
  &gt; (and binary) and it is basically a collection of copy and insert
  &gt; commands [..]

  which means that the current format could change once the internal
  algorithm is changed as the format is not standardized. In addition
  the git binary patch format used for preparing patches for git apply
  is *different* from the xdiff format as can be seen by comparing

  git log -p -a

    commit 6e95bf4bafccf14650d02ab57f3affe669be10cf
    Author: A U Thor &lt;author@example.com&gt;
    Date:   Thu Apr 7 15:14:13 2005 -0700

        modify binary file

    diff --git a/data.bin b/data.bin
    index f414c84..edfeb6f 100644
    --- a/data.bin
    +++ b/data.bin
    @@ -1,2 +1,4 @@
     a
     a^@a
    +a
    +a^@a

  with git log --binary

    commit 6e95bf4bafccf14650d02ab57f3affe669be10cf
    Author: A U Thor &lt;author@example.com&gt;
    Date:   Thu Apr 7 15:14:13 2005 -0700

        modify binary file

    diff --git a/data.bin b/data.bin
    index f414c84bd3aa25fa07836bb1fb73db784635e24b..edfeb6f501[..]
    GIT binary patch
    literal 12
    QcmYe~N@Pgn0zx1O01)N^ZvX%Q

    literal 6
    NcmYe~N@Pgn0ssWg0XP5v

  which seems unexpected.

To resolve these issues this patch makes -G&lt;regex&gt; ignore binary files
by default. Textconv filters are supported and also -a/--text for
getting the old and broken behaviour back.

The -S&lt;block of text&gt; option of log looks for differences that changes
the number of occurrences of the specified block of text (i.e.
addition/deletion) in a file. As we want to keep the current behaviour,
add a test to ensure it stays that way.

[1]: http://www.xmailserver.org/xdiff.html

Signed-off-by: Thomas Braun &lt;thomas.braun@virtuell-zuhause.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'es/diff-color-moved-fix'</title>
<updated>2018-08-15T22:08:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-15T22:08:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=706b0b5e8d683b06e99bdfb2349228b360e4cf03'/>
<id>urn:sha1:706b0b5e8d683b06e99bdfb2349228b360e4cf03</id>
<content type='text'>
One of the "diff --color-moved" mode "dimmed_zebra" that was named
in an unusual way has been deprecated and replaced by
"dimmed-zebra".

* es/diff-color-moved-fix:
  diff: --color-moved: rename "dimmed_zebra" to "dimmed-zebra"
</content>
</entry>
<entry>
<title>Merge branch 'sb/diff-color-move-more'</title>
<updated>2018-08-02T22:30:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-02T22:30:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a81575aa91a015535374bb5b1e0e6dc2a81c74ab'/>
<id>urn:sha1:a81575aa91a015535374bb5b1e0e6dc2a81c74ab</id>
<content type='text'>
"git diff --color-moved" feature has further been tweaked.

* sb/diff-color-move-more:
  diff.c: offer config option to control ws handling in move detection
  diff.c: add white space mode to move detection that allows indent changes
  diff.c: factor advance_or_nullify out of mark_color_as_moved
  diff.c: decouple white space treatment from move detection algorithm
  diff.c: add a blocks mode for moved code detection
  diff.c: adjust hash function signature to match hashmap expectation
  diff.c: do not pass diff options as keydata to hashmap
  t4015: avoid git as a pipe input
  xdiff/xdiffi.c: remove unneeded function declarations
  xdiff/xdiff.h: remove unused flags
</content>
</entry>
<entry>
<title>diff: --color-moved: rename "dimmed_zebra" to "dimmed-zebra"</title>
<updated>2018-07-25T21:23:52Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2018-07-24T21:58:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e3f2f5f9cd9238ae106434278d325eada2719842'/>
<id>urn:sha1:e3f2f5f9cd9238ae106434278d325eada2719842</id>
<content type='text'>
The --color-moved "dimmed_zebra" mode (with an underscore) is an
anachronism. Most options and modes are hyphenated. It is more difficult
to type and somewhat more difficult to read than those which are
hyphenated. Therefore, rename it to "dimmed-zebra", and nominally
deprecate "dimmed_zebra".

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff.c: offer config option to control ws handling in move detection</title>
<updated>2018-07-19T19:02:54Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-18T19:31:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=626c0b5d395196ddabcf9b9a430db385722689d4'/>
<id>urn:sha1:626c0b5d395196ddabcf9b9a430db385722689d4</id>
<content type='text'>
Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff.c: add white space mode to move detection that allows indent changes</title>
<updated>2018-07-19T19:02:54Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2018-07-18T19:31:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ca1f4ae4dfade677647928d28728a0cad125981d'/>
<id>urn:sha1:ca1f4ae4dfade677647928d28728a0cad125981d</id>
<content type='text'>
The option of --color-moved has proven to be useful as observed on the
mailing list. However when refactoring sometimes the indentation changes,
for example when partitioning a functions into smaller helper functions
the code usually mostly moved around except for a decrease in indentation.

To just review the moved code ignoring the change in indentation, a mode
to ignore spaces in the move detection as implemented in a previous patch
would be enough.  However the whole move coloring as motivated in commit
2e2d5ac (diff.c: color moved lines differently, 2017-06-30), brought
up the notion of the reviewer being able to trust the move of a "block".

As there are languages such as python, which depend on proper relative
indentation for the control flow of the program, ignoring any white space
change in a block would not uphold the promises of 2e2d5ac that allows
reviewers to pay less attention to the inside of a block, as inside
the reviewer wants to assume the same program flow.

This new mode of white space ignorance will take this into account and will
only allow the same white space changes per line in each block. This patch
even allows only for the same change at the beginning of the lines.

As this is a white space mode, it is made exclusive to other white space
modes in the move detection.

This patch brings some challenges, related to the detection of blocks.
We need a wide net to catch the possible moved lines, but then need to
narrow down to check if the blocks are still intact. Consider this
example (ignoring block sizes):

 - A
 - B
 - C
 +    A
 +    B
 +    C

At the beginning of a block when checking if there is a counterpart
for A, we have to ignore all space changes. However at the following
lines we have to check if the indent change stayed the same.

Checking if the indentation change did stay the same, is done by computing
the indentation change by the difference in line length, and then assume
the change is only in the beginning of the longer line, the common tail
is the same. That is why the test contains lines like:

 - &lt;TAB&gt; A
 ...
 + A &lt;TAB&gt;
 ...

As the first line starting a block is caught using a compare function that
ignores white spaces unlike the rest of the block, where the white space
delta is taken into account for the comparison, we also have to think about
the following situation:

 - A
 - B
 -   A
 -   B
 +    A
 +    B
 +      A
 +      B

When checking if the first A (both in the + and - lines) is a start of
a block, we have to check all 'A' and record all the white space deltas
such that we can find the example above to be just one block that is
indented.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
