Re: [PATCH 25/25] diff: document the new --color-moved setting
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 30, 2017, 16:04 UTC
- Message-ID
- <CAGZ79kYONNMrB7L65WjwZjSuKOf3rAOWPwjb1bH26MU0owTJ4w@mail.gmail.com>
- In-Reply-To
- <20170630072611.q733inuxdvjmhjgw@ruderich.org>
On Fri, Jun 30, 2017 at 12:26 AM, Simon Ruderich <simon@ruderich.org> wrote:
Show 11 quoted lines
> On Thu, Jun 29, 2017 at 05:07:10PM -0700, Stefan Beller wrote: >> + Small blocks of 3 moved lines or fewer are skipped. > > If I read the commit messages correctly, this "skipping" process > applies to the move detection in general for those smaller blocks > and therefore doesn't mean a malicious move can hide smaller > changes, correct? If so, I find this sentence misleading. Maybe > something like: > > Small blocks of 3 moved lines or fewer are excluded from move > detection and colored as regular diff.
Well, this reads as if "blocks of 3 lines" are excluded, but what I mean is "if all adjacent blocks combined are 3 lines or fewer"
Example of how I understand the code:
context
+ moved line, block A
+ moved line, block A
+ moved line, block B
+ moved line, block A
+ moved line, block A
contextThese five lines are colored, because 5>3, but each individual block is smaller than 3 lines. However we already want to tell the reviewer that the middle line is not part of a contiguous 5 line block, so we have to use alternative color in the middle.
However
context
+ moved line, block A or B
+ moved line, block A or B
contextis omitted, because the number of lines here is fewer than 3 ignoring the block type.
Maybe
If there are fewer than 3 adjacent lines of moved code, they are skipped.
Thanks, Stefan
Show 7 quoted lines
> > Regards > Simon > -- > + privacy is necessary > + using gnupg http://gnupg.org > + public key id: 0x92FEFDB7E44C32F9