title: Git error: "fatal: corrupt patch at line 36"
body: <p>I have a Java file that ends like this:</p>
  
  <pre><code>    }
  }
  </code></pre>
  
  <p>And I mistakenly erased the newline at the end some time ago, but it was fine just until today when I got an error message from Git-GUI when commiting</p>
  
  <pre><code>fatal: corrupt patch at line 36
  </code></pre>
  
  <p>I tried adding the missing newline, but Git seems not to be able to handle it right:</p>
  
  <p>Before adding newline:</p>
  
  <pre><code>     }
   }
  \ No newline at end of file
  </code></pre>
  
  <p>After adding newline:</p>
  
  <pre><code>     }
  -}
  \ No newline at end of file
  +}
  </code></pre>
  
  <p>And it still gives me that error.</p>
  
  <p>I tried reverting changes and adding only the newline without other changes to the file, but it didn't help either.</p>
  
  <p><strong>EDIT:</strong> Adding two or even three newlines doesn't help too.</p>
  
  <p><strong>EDIT2:</strong> This error occurs only when commiting lines within the last hunk.</p>