Re: Custom Merge
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Apr 23, 2012, 12:59 UTC
- Message-ID
- <4F955243.2090103@viscovery.net>
- In-Reply-To
- <loom.20120423T141242-348@post.gmane.org>
Am 4/23/2012 14:25, schrieb Jose Ricardo:
Show 24 quoted lines
> In my project, I have a lot of image files, that I wanted to process using > a different tool. For this, after reading some posts about custom merge > drivers in this forum, I make the following modifications: > > In the file .gitconfig I added the following lines: > > > [merge "imgfile"] > name = Driver for image files > driver = /usr/local/bin/git-merge-img.sh %O %A %B %L > recursive = binary > > and in the .gitinfoattributes I put: > > *.png merge=imgfile > > As I can see, it works calling my custom script during a merge between > two branches that have a .png file. Unfortunately, even after a successfully > merge, the final image is not merged with the one in the other branch. > In order to test it, I've called my script using three images, giving me the > corrected result. > > I don't know if it could help but instead of changing the content of the file > I create another one with the same name during a merge operation.
I have my image merge script configured it like this:
[merge "imgfile"] driver = imgmerge %O %A %B %A
but if you do that, you must be sure that the script does not need to access $2 after it has begun writing to $4.
(I know that it worked because at one time I had forgotten that I have a custom merge driver, and was expecting a merge conflict due to an image file, but there was no conflict, and the result was correct ;-)
-- Hannes