1 Reply Latest reply: Apr 2, 2012 11:46 AM by Andy Taylor RSS

backporting fixes

borges Novice

Hi,

 

Since we changed the source code location from 2_2_* to our current development branch. It may be of interest how to patch the code while ignoring this path change:

 

First create the patch you want to merge:

 

% git format-patch --patience --ignore-all-space --find-copies-harder -3

 

This will generate patches of the last 3 commits. Then you copy the patch you want into your 2_2_AS7 checkout. And do something like this:

 

% git apply --reject --directory=src/main -p5 --ignore-space-change 0007-HORNETQ-895-Fix-dead-lock-between-RemotingConnection.patch

 

The trick here is that:

  • "--reject" will allow a partially successful patch to proceed and will leave the (failed) rest somewhere where you can manually handle it.
  • -p5 will delete the leading 5 path entries of the files to be patched
  • --directory=src/main after -p5, this one will add the given path to the path marked in the diff.

 

So the combination of the last two described options allow you to remap the path of the files you are patching. The first one will allow a job that fails somehow to complete partially (which already helps a lot).

 

If anyone knows a better way to do this, please let me know.