gitgit-gui

Git error: "fatal: corrupt patch at line 36"


I have a Java file that ends like this:

    }
}

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

fatal: corrupt patch at line 36

I tried adding the missing newline, but Git seems not to be able to handle it right:

Before adding newline:

     }
 }
\ No newline at end of file

After adding newline:

     }
-}
\ No newline at end of file
+}

And it still gives me that error.

I tried reverting changes and adding only the newline without other changes to the file, but it didn't help either.

EDIT: Adding two or even three newlines doesn't help too.

EDIT2: This error occurs only when commiting lines within the last hunk.


Solution

  • I tried adding and commiting as I would normally do, but without Git-GUI, using command-line, and it worked.