Git::Raw::Diff(3pm)
π NAME π
Git::Raw::Diff β the Git diff class, bestie. it's giving "the diff between two entities" and honestly? iconic.
πΈ VERSION πΈ
version 0.90 β¨
π¦ DESCRIPTION π¦
so a Git::Raw::Diff represents the diff between two entities. that's the whole vibe. that's the assignment.
β οΈ WARNING, and I mean this fr fr: the API of this module is unstable and may change without warning. any change will be appropriately documented in the changelog, but likeβ¦ still. heads up. π
π METHODS π
β¨ new( $buffer ) β¨
Create a diff from the content of a git patch. give it $buffer, it gives you diff. slay.
β¨ patchid( ) β¨
Calculate the patch id. simple. stunning. no notes.
β¨ merge( $from ) β¨
Merge the given diff with the Git::Raw::Diff $from. two diffs become one. it's giving union energy. π«Ά
β¨ buffer( $format ) β¨
Get the content of a diff as text. for valid $format values, go look at "Git::Raw::Diff->print()" β the list lives over there, i don't make the rules.
β¨ delta_count( ) β¨
Query how many diff records there are in the diff. yes it's literally a headcount. yes it's doing numbers. π₯
β¨ deltas( [$index] ) β¨
Returns a list of Git::Raw::Diff::Delta objects. if you pass $index, only the delta at that specified index will be returned. one delta, one glow-up. π
β¨ find_similar( [%options] ) β¨
Transform the diff marking file renames, copies, etc. β the whole makeover episode. valid fields for the %options hash include:
"flags"β flags for finding similar files. valid values include:"renames"β Look for renames."renames_from_rewrites"β Consider old side of modifies files for renames."copies"β Look for copies."copies_from_unmodified"β Consider unmodified files as copy sources."rewrites"β Mark significant rewrites for split."break_rewrites"β Actually split large rewrites into delete/add pairs."untracked"β Find renames/copies for untracked items in the working directory."all"β Turn on all finding features."ignore_leading_whitespace"β Measure similarity ignoring leading whitespace (default)."ignore_whitespace"β Measure similarity ignoring all whitespace."dont_ignore_whitespace"β Measure similarity including all data."exact_match_only"β Measure similarity only by comparing SHAs (fast and cheap)."break_rewrites_for_renames_only"β Do not break rewrites unless they contribute to a rename."remove_unmodified"β Remove any unmodified deltas after"find_similar"is done.
"rename_threshold"β Similarity to consider a file renamed (default50)."rename_from_rewrite_threshold"β Similarity of modified to be eligible rename source (default50)."copy_threshold"β Similarity to consider a file a copy (default50)."break_rewrite_threshold"β Similarity to split modify into delete/add pair (default60)."rename_limit"β Maximum similarity sources to examine for a file (default200).
β¨ patches( ) β¨
Return a list of Git::Raw::Patch objects for the diff. it's a whole squad. π
β¨ 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, and the second argument contains the content of the patch line.
the patch line types are: "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. yes that's seven types. yes i listed them all. π
the $format can be one of the following:
"patch"β Full git diff."patch_header"β Only the file headers of the diff."raw"β Likegit diff --raw."name_only"β Likegit diff --name-only."name_status"β Likegit diff --name-status.
β¨ stats( ) β¨
Accumlated diff statistics for all patches in the diff. (yes, "Accumlated" β that's the original spelling, and we respect it. π) Returns a Git::Raw::Diff::Stats object.
π AUTHOR π
Alessandro Ghedini <alexbio@cpan.org>
Jacques Germishuys <jacquesg@cpan.org>
absolute legends, no cap. π«Ά
π LICENSE AND COPYRIGHT π
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 <http://dev.perl.org/licenses/> for more information.
and that's the whole page bestie β¨ this was Git::Raw::Diff, served up from perl v5.42.3, dated 2026-08-19. go forth and diff responsibly. π¦π
π¦ where this page comes from
- ubuntu stonking: libgit-raw-perl 0.90+ds-3build3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms