Re: [PATCH] [RFC] Introduce Git.pm

From: Eric Wong <normalperson@yhbt.net>
Date: 2006-06-22 12:31:05
Petr Baudis <pasky@suse.cz> wrote:
> Currently Git.pm just wraps up exec()s of Git commands, but even that
> is not trivial to get right and various Git perl scripts do it in
> various inconsistent ways. And things will get much more interesting
> when we get to XS-izing libgit.

git-svn uses fork/pipe/exec very heavily for both reads and writes and
also a few bidirectional cases, as well.  It would be good exercise to
port it to use Git.pm once it's more complete and stable.

XS-ising libgit would be awesome with all the git-hash-object calls in
git-svn (and other importers, too, I imagine).

> This is mostly to show up what I have so far and gather some comments
> on the general shapes of the interface; I guess in the current shape
> of the API it's suitable for pu at best, but that's not my call.

safe_qx (git-svn) AKA safe_pipe_capture (archimport) would be
non-git-specific, but very useful.

> +	my $pid = open(my $fh, "-|");
> +	if ($pid < 0) {
> +		die "generic($cmd, @args) open: $!";

In Perl, fork returns undef instead of $pid < 0 on failure.  Doing
join(' ',@args) will also make the error message more readable, too :)

-- 
Eric Wong
-
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 Thu Jun 22 12:31:26 2006

This archive was generated by hypermail 2.1.8 : 2006-06-22 12:32:50 EST