title: Is git's implementation of the patience diff algorithm correct?
body: <p><a href="https://stackoverflow.com/questions/40131362/how-to-create-a-proper-patch-when-removing-a-function-and-its-docblock-with-git">This question on Stackoverflow</a> seemed to be a good candidate for the application of the patience diff algorithm. However, while testing my potential answer, I found that <a href="https://stackoverflow.com/questions/4045017/what-is-git-diff-patience-for"><code>git diff --patience</code></a> doesn't work up to my expectations (and, in this case, is no different from the default diff algorithm):</p>
  
  <pre><code>$ cat a
  /**
   * Function foo description.
   */
  function foo() {}
  
  /**
   * Function bar description.
   */
  function bar() {}
  
  $ cat b
  /**
   * Function bar description.
   */
  function bar() {}
  
  $ git diff --no-index --patience a b
  diff --git a/a b/b
  index 3064e15..a93bad0 100644
  --- a/a
  +++ b/b
  @@ -1,9 +1,4 @@
   /**
  - * Function foo description.
  - */
  -function foo() {}
  -
  -/**
    * Function bar description.
    */
   function bar() {}
  </code></pre>
  
  <p>I would expect the diff to be:</p>
  
  <pre><code>diff --git a/a b/b
  index 3064e15..a93bad0 100644
  --- a/a
  +++ b/b
  @@ -1,8 +1,3 @@
  -/**
  - * Function foo description.
  - */
  -function foo() {}
  -
   /**
    * Function bar description.
    */
  </code></pre>
  
  <p>In my understanding, unique common lines in this case are the two lines mentioning <strong>bar</strong>, and the longest common context around those lines should be the function <code>bar()</code> along with its docblock, which means that the diff should boil down to the removed function <code>foo()</code> together with its own docblock and the following blank line.</p>