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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Petr Baudis <pasky@xxxxxxx> 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
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]