Skip to content

Resolve "lb-format may generate invalid patch for files without trailing newline"

With this change, the generated patch correctly contains the special marker \ No newline at end of file when needed.

The test case in #24 (closed) now produces the correct patch file

From nobody Fri Sep 13 13:06:46 2019
From: Gitlab CI <noreply@cern.ch>
Date: Fri, 13 Sep 2019 11:06:46 -0000
Subject: [PATCH] Fixed formatting

patch generated by standalone job


--- a/test.py
+++ b/test.py
@@ -1,4 +1,3 @@
 print('hello')
 
-print( 'test' )
-    
\ No newline at end of file
+print('test')

I found that somebody considered it a bug in Python difflib, but the proposed patch never made it into a release.

Closes #24 (closed)

Edited by Marco Clemencic

Merge request reports

Loading