Re: Implementing diff, was Re: git 0.99.7b doesn't build on Cygwin

From: Davide Libenzi <davidel@xmailserver.org>
Date: 2005-09-26 02:08:20
On Sun, 25 Sep 2005, Johannes Schindelin wrote:

>> Linus Torvalds <torvalds@osdl.org> writes:
>>
>>> The GNU diff sources are hard enough to read that I don't think we want to
>>> try to merge the unified diff generation from there.
>>
>> I was talking with GNU diff maintainer and his impression was
>> that CVS folks may have done enough libification -- I'll find
>> time to look at CVS code and see how much damage we are talking
>> about.
>
> I am not sure if it would be wise to completely do away with the current
> method: Often, I call git-diff with my own wdiff-helper. Also, options
> like "-b" to diff are very useful, and would have to be implemented, too.

What you'd have to do, if you chose to use diffutils stuff, is to 
transform the main() of diff in diff_main(), use setjmp/longjmp to capture 
its exit()s, and make it use a proper allocator (if you want to avoid 
leaks upon aborts). You can see an example inside the diff/libgdiff 
directory of this packages:

https://www.cvshome.org
http://www.opencm.org

In that way, instead of executing "diff -u ...", you'd call diff_main() 
with the proper args array. The CVS one (the other project seems dead, 
and they lifted the thing from CVS anyway) should be readily usable.


- Davide


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Sep 26 02:08:07 2005

This archive was generated by hypermail 2.1.8 : 2005-09-26 02:08:10 EST