All of lore.kernel.org
 help / color / mirror / Atom feed
* Custom Merge
@ 2012-04-23 12:25 Jose Ricardo
  2012-04-23 12:59 ` Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Jose Ricardo @ 2012-04-23 12:25 UTC (permalink / raw)
  To: git

Hi everyone!

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.

Does anyone could help me pointing what could be wrong with this?

Thanks a lot!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Custom Merge
  2012-04-23 12:25 Custom Merge Jose Ricardo
@ 2012-04-23 12:59 ` Johannes Sixt
  2012-04-23 14:28   ` Jose Ricardo
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2012-04-23 12:59 UTC (permalink / raw)
  To: Jose Ricardo; +Cc: git

Am 4/23/2012 14:25, schrieb Jose Ricardo:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Custom Merge
  2012-04-23 12:59 ` Johannes Sixt
@ 2012-04-23 14:28   ` Jose Ricardo
  0 siblings, 0 replies; 3+ messages in thread
From: Jose Ricardo @ 2012-04-23 14:28 UTC (permalink / raw)
  To: git

Johannes Sixt <j.sixt <at> viscovery.net> writes:

> 
> 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 
> 

Hi Johannes,

Thanks a lot for your help. 

I have checked it and I'm writing to the right file after reading the data from
 it. According to what I see, only the modifications made on the current 
branch are saved, even after applying the delta to the right image file.

One question is: does it matter if I save the whole file, replacing the old with 
this new one? Or do I need to open the old one and modify its content?

Thanks again!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-23 14:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 12:25 Custom Merge Jose Ricardo
2012-04-23 12:59 ` Johannes Sixt
2012-04-23 14:28   ` Jose Ricardo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.