Subject: Re: Statictics on Git.pm usage in git commands (was: [PATCH 2/3] add new Git::Repo API)

From: Petr Baudis <[email-masked]>
Date: Sat, 19 Jul 2008 23:14:03 +0200

On Sat, Jul 19, 2008 at 10:54:24PM +0200, Jakub Narebski wrote:
> On Fri, 18 July 2008, Petr Baudis wrote:
> 
> > But the experience shows that the pipe interface is actually
> > the _most_ used part of the Git Perl API.

  Note that I referred both to scripts that are part of Git and
(actually more) to various third-party scripts I wrote externally.

> Here is some statistics on the usage of Git Perl API among built-in
> and contrib commands.

  Thanks!

> The situation is worse for scripts in 'contrib/'.  From those, only
> contrib/examples/git-remote.perl uses Git.pm; neither blameview,
> continuous, git-import and import-tars in fast-import, setgitperms
> and update-paranoid in hooks, stats, nor other Perl scripts in
> examples (git-rerere, git-svnimport) include "use Git".

  I have actually once converted blameview to use Git locally, but in
the end never got around to submit it; I wonder if I have the source
still around somewhere. Not so important, I guess.

> Below there are stats on how different commands from Git.pm are
> used in mentioned Perl scripts:
> 
> 2. git-cvsexportcommit.perl uses (besides ->repository() constructor)
>    only once ->config; so I guess that current interface wrapping
>    git-config should stay, because parsing whole config for such
>    situation would be overkill.

  I don't understand. Parsing whole config happen will either happen in
git-config or in Git::Config, and the performance difference is so tiny
that it is not really worth the API complexity, I believe.

> 3. git-send-email.perl uses 5 config, 2 config_bool, 2 ident_person
>    (for author and for committer), 1 version, and of course once
>    ->repository() constructor.  
> 
>    Here we can see how to work around current API to: it uses
>    Git::config(@repo, "sendemail.identity") form, where 
>    	my $repo = eval { Git->repository() };
>    	my @repo = $repo ? ($repo) : ();
>    to make it work both with git repository (using repo config), and
>    outside/without git repository, using only user and system git
>    config.

  With the envisioned model, it could use $git which would be either
a reference to a Git::Standalone singleton or Git::Repo instance.

-- 
				Petr "Pasky" Baudis
As in certain cults it is possible to kill a process if you know
its true name.  -- Ken Thompson and Dennis M. Ritchie