[Lazarus] git diff enhancement

Martin Frb lazarus at mfriebe.de
Tue Sep 14 17:17:35 CEST 2021

In order for git to show pascal function headers.

Add the following to your config

[diff "fpc"]
   xfuncname = "^(((class[ 
\\t]+)?(procedure|function)|constructor|destructor|[ \\t].*[ \\t]*=[ 

then create a file
and add the following

*.pas diff=fpc
*.pp diff=fpc
*.lpr diff=fpc
*.inc diff=fpc

Diffs then look like (note the @@ line has the "function" header)

  components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas 
index ea4fbee06a..8fd79d673d 100644
--- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas
+++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas
@@ -1745,7 +1745,8 @@ function TFPDBGDisassembler.PrepareEntries(AnAddr: 
TDbgPtr; ALinesBefore, ALines
    p: pointer;
-  ASrcFileName: string;
+  ASrcFileName,
+  AFuncName: string;
    ASrcFileLine: integer;
    i,j, sz, bytesDisassembled, bufOffset: Integer;
    Sym: TFpSymbol;

More information about the lazarus mailing list