{"thread":{"id":"30307","subject":"Custom Merge","startedAt":"2012-04-23T12:25:50Z","lastAt":"2012-04-23T14:28:47Z","messageCount":3,"participants":["Jose Ricardo","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189863","messageId":"loom.20120423T141242-348@post.gmane.org","threadId":"30307","inReplyTo":null,"subject":"Custom Merge","fromName":"Jose Ricardo","fromEmail":"josericardo.jr@gmail.com","sentAt":"2012-04-23T12:25:50Z","receivedAt":"2012-04-23T12:25:50Z","isPatch":false,"sender":{"key":"josericardo.jr@gmail.com","avatar":null},"body":"Hi everyone!\n\nIn my project, I have a lot of image files, that I wanted to process using \na different tool. For this, after reading some posts about custom merge \ndrivers in this forum, I make the following modifications:\n\nIn the file .gitconfig I added the following lines:\n\n\n[merge \"imgfile\"]\n        name = Driver for image files\n        driver = /usr/local/bin/git-merge-img.sh %O %A %B %L\n        recursive = binary\n\nand in the .gitinfoattributes I put:\n\n*.png   merge=imgfile\n\nAs I can see, it works calling my custom script during a merge between\n two branches that have a .png file. Unfortunately, even after a successfully \nmerge, the final image is not merged with the one in the other branch. \nIn order to test it, I've called my script using three images, giving me the \ncorrected result.\n\nI don't know if it could help but instead of changing the content of the file\n I create another one with the same name during a merge operation.\n\nDoes anyone could help me pointing what could be wrong with this?\n\nThanks a lot!\n"},{"id":"189875","messageId":"4F955243.2090103@viscovery.net","threadId":"30307","inReplyTo":"loom.20120423T141242-348@post.gmane.org","subject":"Re: Custom Merge","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-04-23T12:59:47Z","receivedAt":"2012-04-23T12:59:47Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 4/23/2012 14:25, schrieb Jose Ricardo:\n> In my project, I have a lot of image files, that I wanted to process using \n> a different tool. For this, after reading some posts about custom merge \n> drivers in this forum, I make the following modifications:\n> \n> In the file .gitconfig I added the following lines:\n> \n> \n> [merge \"imgfile\"]\n>         name = Driver for image files\n>         driver = /usr/local/bin/git-merge-img.sh %O %A %B %L\n>         recursive = binary\n> \n> and in the .gitinfoattributes I put:\n> \n> *.png   merge=imgfile\n> \n> As I can see, it works calling my custom script during a merge between\n>  two branches that have a .png file. Unfortunately, even after a successfully \n> merge, the final image is not merged with the one in the other branch. \n> In order to test it, I've called my script using three images, giving me the \n> corrected result.\n> \n> I don't know if it could help but instead of changing the content of the file\n>  I create another one with the same name during a merge operation.\n\nI have my image merge script configured it like this:\n\n[merge \"imgfile\"]\n\tdriver = imgmerge %O %A %B %A\n\nbut if you do that, you must be sure that the script does not need to\naccess $2 after it has begun writing to $4.\n\n(I know that it worked because at one time I had forgotten that I have a\ncustom merge driver, and was expecting a merge conflict due to an image\nfile, but there was no conflict, and the result was correct ;-)\n\n-- Hannes\n"},{"id":"189876","messageId":"loom.20120423T162755-821@post.gmane.org","threadId":"30307","inReplyTo":"4F955243.2090103@viscovery.net","subject":"Re: Custom Merge","fromName":"Jose Ricardo","fromEmail":"josericardo.jr@gmail.com","sentAt":"2012-04-23T14:28:47Z","receivedAt":"2012-04-23T14:28:47Z","isPatch":false,"sender":{"key":"josericardo.jr@gmail.com","avatar":null},"body":"Johannes Sixt <j.sixt <at> viscovery.net> writes:\n\n> \n> I have my image merge script configured it like this:\n> \n> [merge \"imgfile\"]\n> \tdriver = imgmerge %O %A %B %A\n> \n> but if you do that, you must be sure that the script does not need to\n> access $2 after it has begun writing to $4.\n> \n> (I know that it worked because at one time I had forgotten that I have a\n> custom merge driver, and was expecting a merge conflict due to an image\n> file, but there was no conflict, and the result was correct \n> \n\nHi Johannes,\n\nThanks a lot for your help. \n\nI have checked it and I'm writing to the right file after reading the data from\n it. According to what I see, only the modifications made on the current \nbranch are saved, even after applying the delta to the right image file.\n\nOne question is: does it matter if I save the whole file, replacing the old with \nthis new one? Or do I need to open the old one and modify its content?\n\nThanks again!\n"}]}