NAME

Git::Diff - Git submodule to convert git diff into a perl hash-ref

VERSION

Version 0.000102

SUBROUTINES/METHODS

new

Constructor with given params

changes_by_line

Returns the full categorized hashref with file changes

changed_lines

Returns non categorized file changes

diff

Returns string from git diff command

SYNOPSIS

my $o_diff = Git::Diff->new(
    directory   => $ENV{GIT_DIR},
    worktree    => $ENV{GIT_WORK_TREE},
    base_branch => $ENV{BASE_BRANCH}
);
$o_diff->changes_by_line;

Returns following structure

{
    some/file/in/git {
        addition      {
            23   "   my ( $string ) = @_;"
        },
        changed       {
            '-23 +23 '   "sub is_identifier {
    -   my ($string) = @_;
    +   my ( $string ) = @_;
    "
        },
        raw           undef,
        subtraction   {
            23   "   my ($string) = @_;"
        },
    }
}

DIAGNOSTICS

perlcritic:

DEPENDENCIES

  • Internal usage

    Git

INCOMPATIBILITIES

BUGS AND LIMITATIONS

A list of current bugs and issues can be found at the CPAN site

https://gitlab.com/mziescha/git-diff/issues

To report a new bug or problem, use the link on this page.

DESCRIPTION

Run and prase git diff command for perl hash structure

CONFIGURATION AND ENVIRONMENT

Need same git configs like Git

AUTHOR

Mario Zieschang, <mziescha at cpan.org>

LICENSE AND COPYRIGHT