From: Jonathan Tan Date: Tue, 24 Apr 2018 21:50:50 GMT Subject: Re: [PATCH 5/7] diff.c: add a blocks mode for moved code detection Message-ID: <20180424145050.e0ad29d4f304216441656057@google.com> In-Reply-To: <20180424210330.87861-6-sbeller@google.com> On Tue, 24 Apr 2018 14:03:28 -0700 Stefan Beller wrote: > Suggested-by: Ævar Arnfjörð Bjarmason > (https://public-inbox.org/git/87o9j0uljo.fsf@evledraar.gmail.com/) > Signed-off-by: Stefan Beller Firstly, I don't know if this is the right solution- as written in the linked e-mail [1], the issue might be more that the config conflates 2 unrelated things, not that a certain intersection is missing. [1] https://public-inbox.org/git/87muykuij7.fsf@evledraar.gmail.com/ Optional: Probably better to put the link inline, instead of in the trailer. > -test_expect_success 'detect permutations inside moved code -- dimmed_zebra' ' > +test_expect_success 'detect blocks of moved code' ' > git reset --hard && > cat <<-\EOF >lines.txt && > long line 1 > @@ -1271,6 +1271,52 @@ test_expect_success 'detect permutations inside moved code -- dimmed_zebra' ' > test_config color.diff.newMovedDimmed "normal cyan" && > test_config color.diff.oldMovedAlternativeDimmed "normal blue" && > test_config color.diff.newMovedAlternativeDimmed "normal yellow" && Add a comment here explaining that these colors do not appear in the output, but merely set to recognizable values to ensure that they do not appear in the output. > + > + git diff HEAD --no-renames --color-moved=blocks --color | > + grep -v "index" | > + test_decode_color >actual && > + cat <<-\EOF >expected && > + diff --git a/lines.txt b/lines.txt > + --- a/lines.txt > + +++ b/lines.txt > + @@ -1,16 +1,16 @@ > + -long line 1 > + -long line 2 > + -long line 3 > + line 4 > + line 5 > + line 6 > + line 7 > + line 8 > + line 9 > + +long line 1 > + +long line 2 > + +long line 3 > + +long line 14 > + +long line 15 > + +long line 16 > + line 10 > + line 11 > + line 12 > + line 13 > + -long line 14 > + -long line 15 > + -long line 16 > + EOF > + test_cmp expected actual > + > +' [snip]