git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
EWEric Wong <normalperson@yhbt.net>
Date
Jun 22, 2006, 02:31 UTC
Message-ID
<20060622023104.GB27871@hand.yhbt.net>
In-Reply-To
<20060622003546.17760.23089.stgit@machine.or.cz>
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
Previous: Alex RiesenNext: Petr Baudis
Message 4 of 7 in “[RFC] Introduce Git.pm”
  1. [RFC] Introduce Git.pmPetr Baudis, Jun 22, 2006
  2. Junio C HamanoJun 22, 2006
  3. Alex RiesenJun 22, 2006
  4. Eric WongJun 22, 2006
  5. Petr BaudisJun 22, 2006
  6. Jakub NarebskiJun 22, 2006
  7. Junio C HamanoJun 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.