gnustavo / Git-Hooks

Framework for implementing Git (and Gerrit) hooks
http://search.cpan.org/dist/Git-Hooks/
41 stars 17 forks source link

Using Git.pm makes this painful to use #38

Closed autarch closed 7 years ago

autarch commented 7 years ago

Here's the problem I encountered ...

The git package include a version of Git.pm that it uses to implement some commands, notably git add -p. This module ends up at /usr/share/perl5/Git.pm.

I'm not using system Perl for local dev, however, so the perl in my path is not /usr/bin/perl, and my perlbrewed perl does not include /usr/share/perl5 in @INC.

This means that if I install Git::Hooks, it ends up pulling in the CPAN version of Git.pm. Unfortunately, that version seems to break git add -p.

I think this is because the CPAN Git.pm is simply not keeping up to date with the one shipped with the Git core.

But I suspect even if the CPAN version were kept up to date there might be an opposite problem where installing the CPAN version breaks the core git commands because the CPAN version is newer than the one that the local git expects.

I think the easiest option would be to simply copy the portion of Git.pm that you need into your distro so you do not depend on code that is distributed outside the normal Perl module distro mechanism.

gnustavo commented 7 years ago

I feel your pain too. ;-)

I never thought about incorporating part of Git in Git::Hooks but some time ago I evaluated other Git wrapper packages available at CPAN and decided that it would be best to substitute Git::Repository for Git. It seems to be well maintained and featureful.

Do you know it? What do you think of this?

autarch commented 7 years ago

Using Git::Repository sounds like a great idea!

gnustavo commented 7 years ago

Great. Thanks.

I'll leave on vacations next month and I intend to have some fun with Git::Hooks by implementing a few of the things that are in my to do list. I'll try to do it then. Please, hold on! :)

gnustavo commented 7 years ago

I've released a TRIAL version 2.0.0 of Git::Hooks. It uses Git::Repository now. I'll wait for the first CPANTesters reports before doing a final release.