[fpc-pascal] Git line endings leading to patch problems - was [Semi-OT] Git format patches don't seem to work

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Oct 7 15:11:55 CEST 2011

On 07/10/2011 11:28, Marco van de Voort wrote:
> Even up to date patch doesn't always process lineendings properly btw. I
> have to dos2unix often on *nix too.

Interesting. I would think sharing code between platform with patches is
a bog-standard task these days, and all tools in question should work
perfectly with such files. Oh well.

> Recently a lot of patches with incorrect filenames, or no filenames if the
> patch is for a single file, or even not in universal format have been
> submitted, and it takes some work (doable, but annoying) to apply them.

In that case you do much more effort that I. I simply return to sender
and tell them to send me a universal patch format, and a link to my
website on how to generate patches.

> Since the patches aren't tagged with what generated them, I assumed it was
> GIT based.

That would be an incorrect assumption.

Simply dumping a 'git diff' output to file, always includes the '--git'
hint in the first line. See below.

Alternatively, using 'git format-patch' which generates patch files from
local commits, also includes the git name including the git version
number in the generated patch files.

$ git diff
diff --git a/Source/revision.inc b/Source/revision.inc
index f827943..a64eedc 100644
--- a/Source/revision.inc
+++ b/Source/revision.inc
@@ -1 +1 @@
- '3.0.9';
+ '';


I believe your "real culprit" might be Lazarus IDE itself. eg: When it
detects external file changes it pops up with a diff window. That window
shows non-universal patch format output, and no filename or path
relating to the patches either. So maybe somebody has been copy and
pasting that. Yuck!  Here is a small example from Lazarus IDE itself.

*** 1,4 ****
! unit mmUtils;

  {$I M2Defines.inc}

--- 1,5 ----
! ´╗┐unit mmUtils;

  {$I M2Defines.inc}

*** 7,12 ****
--- 8,14 ----

Maybe somebody should file a bug report with Lazarus IDE project and
tell them to switch to the more often used universal patch format.

  - Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

More information about the fpc-pascal mailing list