Subject: Re: Problem with Git.pm bidi_pipe methods

From: Christian Jaeger <[email-masked]>
Date: Tue, 28 Oct 2008 10:12:44 +0100

Philippe Bruhat (BooK) wrote:
> Hi,
>
> To be able to call commit-tree from a Perl program, I had to use
> command_bidi_pipe() to pass the message on standard input, and get the
> new commit id on standard output. The only problem I have is that the
> method doesn't work (or at least, doesn't work like the other
> command_... methods).

Not really an answer on how to fix Git.pm, but: you may want to subclass 
Git.pm and add your own methods ad interim. See the thread "[PATCH] 
Git.pm: do not break inheritance" [1] about how to subclass (I see that 
this patch is actually in {next,pu} already, and anyway you can use the 
runtime patching approach I described there).

That approach of using subclasses has two benefits: (a) it will tend to 
make your code work with various versions of Git (i.e. one without a 
fixed command_bidi_pipe method), and (b) you will be much more free to 
extend the code. The drawback will be of course that your inventions 
won't necessarily make it back to Git.pm, but I'm tempted to think that 
some innovation taking place before settling on what should make it back 
to Git.pm (or, if incompatible, possibly a new Git.pm) would be worthwhile.

For an actual example in writing Git subclasses see "[ANNOUNCE] intergit 
repository-linking tool (early release)" [2].

Christian.

[1] http://article.gmane.org/gmane.comp.version-control.git/98568
[2] http://article.gmane.org/gmane.comp.version-control.git/99197