View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Jacques Germishuys > Git-Raw > Git::Raw::Diff



Annotate this POD


View/Report Bugs
Module Version: 0.79   Source  


Git::Raw::Diff - Git diff class


version 0.79


A Git::Raw::Diff represents the diff between two entities.

WARNING: The API of this module is unstable and may change without warning (any change will be appropriately documented in the changelog).


new( $buffer )

Create a diff from the content of a git patch.

patchid( )

Calculate the patch id.

merge( $from )

Merge the given diff with the Git::Raw::Diff $from.

buffer( $format )

Get the content of a diff as text. See Git::Raw::Diff->print() for valid $format values.

delta_count( )

Query how many diff records there are in the diff.

deltas( [$index] )

Returns a list of Git::Raw::Diff::Delta objects. If $index is specified only the delta at the specified index will be returned.

find_similar( [\%options] )

Transform the diff marking file renames, copies, etc. Valid fields for the %options hash include:

patches( )

Return a list of Git::Raw::Patch objects for the diff.

print( $format, $callback )

Generate text output from the diff object. The $callback will be called for each line of the diff with two arguments: the first one represents the type of the patch line ("ctx" for context lines, "add" for additions, "del" for deletions, "file" for file headers, "hunk" for hunk headers, "bin" for binary data or "noeol" if both files have no LF at end) and the second argument contains the content of the patch line.

The $format can be one of the following:

stats( )

Accumlated diff statistics for all patches in the diff. Returns a Git::Raw::Diff::Stats object.


Alessandro Ghedini <>

Jacques Germishuys <>


Copyright 2012 Alessandro Ghedini.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: