title: New git diff compaction heuristic isn't working
body: <h2>Update</h2>
  
  <p>This is solved now, thanks to @torek's answer</p>
  
  <p>I needed to have more lines above the new addition so that Git could move up the diff'ed block, and by that I mean:</p>
  
  <pre><code>+a
  +b
  +c
  +
  +["foo", "bar", "baz"].map do |i|
  +  i
  +end
  +
   ["foo", "bar", "baz"].map do |i|
     i.upcase
   end
  </code></pre>
  
  <blockquote>
    <p>Note: I tried with a single line-break instead of <code>a\nb\nc\n</code> and it also worked as well</p>
  </blockquote>
  
  <hr>
  
  <h2>Original Question...</h2>
  
  <p>I'm using Git 2.9 on Mac OSX</p>
  
  <p>Here is a reduced test case:</p>
  
  <pre><code>$ mkdir git-highlight &amp;&amp; cd git-highlight
  $ touch foo.rb
  </code></pre>
  
  <p>I add and commit the following content:</p>
  
  <pre><code>["foo", "bar", "baz"].map do |i|
    i.upcase
  end
  </code></pre>
  
  <p>Now I modify the file to have the following content:</p>
  
  <pre><code>["foo", "bar", "baz"].map do |i|
    i
  end
  
  ["foo", "bar", "baz"].map do |i|
    i.upcase
  end
  </code></pre>
  
  <p>If I was to run either <code>git diff</code> or <code>git diff --compaction-heuristic</code> then I get the following <em>unexpected</em> output:</p>
  
  <pre><code>diff --git a/foo.rb b/foo.rb
  index 9056b22..f0d289a 100644
  --- a/foo.rb
  +++ b/foo.rb
  @@ -1,3 +1,7 @@
   ["foo", "bar", "baz"].map do |i|
  +  i
  +end
  +
  +["foo", "bar", "baz"].map do |i|
     i.upcase
   end
  </code></pre>
  
  <p>If you read this blog post from GitHub <a href="https://github.com/blog/2188-git-2-9-has-been-released" rel="noreferrer">https://github.com/blog/2188-git-2-9-has-been-released</a> I'm led to believe that my output should look something more like:</p>
  
  <pre><code>+["foo", "bar", "baz"].map do |i|
  +  i
  +end
  +
   ["foo", "bar", "baz"].map do |i|
     i.upcase
   end
  </code></pre>
  
  <p>The idea being git's diffing algorithm is more intelligent and able to identify the block change.</p>
  
  <p>I've also tried adding the following to my <code>~/.gitconfig</code> but it doesn't make any difference to the outcome, I still get the unexpected output:</p>
  
  <pre><code>[diff]
    compactionHeuristic = true
  </code></pre>
  
  <p>Any ideas on what I'm missing here?</p>