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

From: Jakub Narebski <[email-masked]>
Date: Sun, 20 Jul 2008 02:16:36 +0200

On Sat, 19 July 2008, Petr Baudis wrote:
> On Sat, Jul 19, 2008 at 10:54:24PM +0200, Jakub Narebski wrote:

> > 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.

So that the code would look like the following, instead:

  my $git = new Git::Cmd; # or Git::Standalone, or Git::CommandFactory
  my $repo = eval { Git->repository() };
  $git = $repo if $repo;

and later use

  $git->config('sendemail.identity');

By the way, git-svn can use command(...) instead of $repo->command(...)
because it sets $ENV{'GIT_DIR'} if it is unset... but I don't see
where Git.pm inserts 'git' to commands list...
-- 
Jakub Narebski
Poland