{"thread":{"id":"16031","subject":"Problem with Git.pm bidi_pipe methods","startedAt":"2008-10-24T00:14:46Z","lastAt":"2008-11-23T19:03:14Z","messageCount":3,"participants":["Philippe Bruhat (BooK)","Christian Jaeger","nadim khemir"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"93812","messageId":"20081024001446.GE17717@plop","threadId":"16031","inReplyTo":null,"subject":"Problem with Git.pm bidi_pipe methods","fromName":"Philippe Bruhat (BooK)","fromEmail":"philippe.bruhat@free.fr","sentAt":"2008-10-24T00:14:46Z","receivedAt":"2008-10-24T00:14:46Z","isPatch":false,"sender":{"key":"philippe.bruhat@free.fr","avatar":"https://gravatar.com/avatar/5e8b60cb2f5f2cd2671543f2f53dcb8f529490f98492a333f96636622eb3adef?d=mp&s=160"},"body":"Hi,\n\nTo be able to call commit-tree from a Perl program, I had to use\ncommand_bidi_pipe() to pass the message on standard input, and get the\nnew commit id on standard output. The only problem I have is that the\nmethod doesn't work (or at least, doesn't work like the other\ncommand_... methods).\n\n    sub command_bidi_pipe {\n        my ($pid, $in, $out);\n        $pid = open2($in, $out, 'git', @_);\n        return ($pid, $in, $out, join(' ', @_));\n    }\n\nFirst, it calls git in the current working dir, when all the other\ncommand_... methods do the appropriate chdir depending on the Git object.\n\nSecond, it can't be used as a method, since $self is not removed from @_\nbefore calling open2, leading to errors such as this one:\n\n    git: 'Git=HASH(0x82f898c)' is not a git-command. See 'git --help'.\n\nThird, no access is given to STDERR (open3 may help).\n\nI'm very sorry to complain without proposing a patch.\n\nI think solving the current directory problem is probably going to be\ndifficult with open2/open3, since open2 does the fork+exec, whereas Git.pm\nhandles the fork+chdir+exec itself for the other command_...  methods.\nAnd so there is no room to chdir when calling open2.\n\n-- \n Philippe Bruhat (BooK)\n\n Treat those you outrank well... you never know when they will outrank you.\n                                                 (Moral from Groo #7 (Image))\n"},{"id":"94097","messageId":"4906D78C.4030409@jaeger.mine.nu","threadId":"16031","inReplyTo":"20081024001446.GE17717@plop","subject":"Re: Problem with Git.pm bidi_pipe methods","fromName":"Christian Jaeger","fromEmail":"christian@jaeger.mine.nu","sentAt":"2008-10-28T09:12:44Z","receivedAt":"2008-10-28T09:12:44Z","isPatch":false,"sender":{"key":"christian@jaeger.mine.nu","avatar":null},"body":"Philippe Bruhat (BooK) wrote:\n> Hi,\n>\n> To be able to call commit-tree from a Perl program, I had to use\n> command_bidi_pipe() to pass the message on standard input, and get the\n> new commit id on standard output. The only problem I have is that the\n> method doesn't work (or at least, doesn't work like the other\n> command_... methods).\n\nNot really an answer on how to fix Git.pm, but: you may want to subclass \nGit.pm and add your own methods ad interim. See the thread \"[PATCH] \nGit.pm: do not break inheritance\" [1] about how to subclass (I see that \nthis patch is actually in {next,pu} already, and anyway you can use the \nruntime patching approach I described there).\n\nThat approach of using subclasses has two benefits: (a) it will tend to \nmake your code work with various versions of Git (i.e. one without a \nfixed command_bidi_pipe method), and (b) you will be much more free to \nextend the code. The drawback will be of course that your inventions \nwon't necessarily make it back to Git.pm, but I'm tempted to think that \nsome innovation taking place before settling on what should make it back \nto Git.pm (or, if incompatible, possibly a new Git.pm) would be worthwhile.\n\nFor an actual example in writing Git subclasses see \"[ANNOUNCE] intergit \nrepository-linking tool (early release)\" [2].\n\nChristian.\n\n[1] http://article.gmane.org/gmane.comp.version-control.git/98568\n[2] http://article.gmane.org/gmane.comp.version-control.git/99197\n"},{"id":"96384","messageId":"200811232003.14428.nadim@khemir.net","threadId":"16031","inReplyTo":"20081024001446.GE17717@plop","subject":"Re: Problem with Git.pm bidi_pipe methods","fromName":"nadim khemir","fromEmail":"nadim@khemir.net","sentAt":"2008-11-23T19:03:14Z","receivedAt":"2008-11-23T19:03:14Z","isPatch":false,"sender":{"key":"nadim@khemir.net","avatar":null},"body":"On Friday 24 October 2008 02.14.46 Philippe Bruhat (BooK) wrote:\n> To be able to call commit-tree from a Perl program, I had to use\n> command_bidi_pipe() to pass the message on standard input, and get the\n> ...\n\nHi Philippe, I'm going to take over the Git.pm maintenance and I'd be happy to \ndiscuss this problem with you (you know whwere to find me right ;) and I'll \nbe happy to hear your suggestions too.\n\nNadim.\n"}]}