[fpc-pascal] [Semi-OT] Git format patches don't seem to work

Reinier Olislagers reinierolislagers at gmail.com
Tue Oct 4 14:41:32 CEST 2011


On 4-10-2011 13:14, Marco van de Voort wrote:
> In our previous episode, Reinier Olislagers said:
>> Having some trouble creating patches that actually work.
>> (On Windows)
>> I've been using git to get FPC trunk and
>> git diff --no-prefix > %temp%\mypatch.diff
>> rem --no-prefix : Do not show any source or destination prefix.
>> to create patches.
> 
> I don't know about GIT, but some tips:
> 
> 1. Play with lineending.  (I use cygwin's dos2unix and unix2dos to convert)
> 2. Also make sure that the generated diffs are in the universal format.
Thanks, Marco & cobines:

That seems to be it!

Unified format: yep, running either
git diff --no-prefix > %temp%\mypatch.diff
or
git diff --no-prefix --unified=3 > %temp%\mypatch.diff
gives the same results.

git diff (in my install at least) seems to generate Unix line endings.
If I do something like
cd /d C:\Development\Fpc\Source\packages\fcl-extra\src\win
git diff --no-prefix > %temp%\gitpatch.diff
rem convert unix line endings to dos:
sfk lf-to-crlf %temp%\gitpatch.diff
rem using swiss file knife, for some reason I hate cygwin ;)
ren %temp%\gitpatch.diff gitpatch_convertedtodoslineending.diff
patch -p5 < %temp%\gitpatch_convertedtodoslineending.diff
it seems to work.

Unfortunately, git diff doesn't seem to have any arguments for line end
conversion, but there must be some setting/config somewhere that I had
set incorrectly...

I'll get back when I know more...

Thanks!

Reinier



More information about the fpc-pascal mailing list