Subject: Re: GSoC Application [ Parallelism + Git.pm ]

From: Jakub Narebski <[email-masked]>
Date: Thu, 22 Mar 2012 14:33:03 +0100

On Wed, 21 Mar 2012, Subho Banerjee wrote:

> I had some time to look through the perl module in the Git sources and
> I wanted to summarize the changes that need to be made -
> 
> [Primary Task]
> [1] Move exception handling from Error::Simple to Try::Tiny and Exception::Class

Well, that is not as much "primary task" as "minimal scope"...

We have also decide if we want to keep compatibility layer, including
git_cmd_try.  Git commands in Perl can be rewriten to using Try::Tiny
directly, but I wonder if there are out of tree Perl scripts and modules
that use Git module, and would be broken by not preserving backward
compatibility.

Another issue of note is whether we want to have all non-core Git.pm
prerequisites included like private-Error.pm (though I think in 'inc/'
or something).

> [Additional]
> [2] A Git::Config module that parses the .gitconfig file and the
> .git/config file in each repository (Is it one of these files or both?)

I don't think parsing git config file format in Perl is a good idea.
What I had in mind was to use `git config -l -z` output, reading all
configuration at once with a single git command.  

Note that this would require converting to specific types, like e.g.
turning true values of git config (e.g. string "true") into Perl
true (1).  The --int, --bool, --bool-or-int and --path should be easy;
the problem could be with --get-colorbool and --get-color.

Optionally (if possible) make it so Git / Git::Repo object uses either
one "git config --get <key>" for each $git->config(<key>) request, or
cached values from single "git config -l -z" via Git::Config, depending
on constructor options ('lazy_config' => 1).  Then we could fall back
to one command for one access for unknown types...

> [3] Parsing Tree and Commit objects and then traverse the tree
> structure in Perl through a Git::Commit module.

'commit', 'tag' and 'tree', and parsing and formatting ident fields.
Note that there is a difference between 'raw' output format ("git cat-file"),
and  e.g. "git ls-tree" for 'tree' objects.

If by 'traverse the tree structure in Perl through a Git::Commit module.'
you mean traversing DAG of revisions, then I think it is out of scope.

And there is also matter of parsing diff output (raw/tree, numstat,
patchset).

> [4] Cleaning-up improving the API.
> In general move towards an module that can access and change data in
> the configuration and commit status using Perl instead of the fork and
> IPC being used now.

Yes, so that most if not all operations can be done on the level of Git.pm
methods or subroutines, and not having to invoke git commands and parse
their output by hand.

This probably needs to be done by examining what git commands in Perl
need.

> Is this what you expect as a part of the GSoC work? Could you please
> tell me if I am missing something.

Another task could be CPAN-ification of Git.pm.  This _could_ include
creating a separate repository for Git.pm (with all thats entailed),
and subtree-mergeing it into git.git like git-gui and gitk are. 

Yet another task could be making all git commands in Perl use Git.pm
(well, at least those actively maintained).

Perhaps also cleaning those Perl::Critic warnings that make sense.
-- 
Jakub Narebski
Poland