Skip to content
Browse files

Index/Entry.xs: Added

  • Loading branch information...
1 parent dafdfea commit b12e376a997ebacf7e1a2cdd98c51c172802a512 @jacquesg committed
Showing with 86 additions and 0 deletions.
  1. +2 −0 Raw.xs
  2. +39 −0 lib/Git/Raw/Index/Entry.pm
  3. +1 −0 typemap
  4. +44 −0 xs/Index/Entry.xs
View
2 Raw.xs
@@ -23,6 +23,7 @@ typedef git_diff_delta * Diff_Delta;
typedef git_diff_file * Diff_File;
typedef git_diff_hunk * Diff_Hunk;
typedef git_index * Index;
+typedef git_index_entry * Index_Entry;
typedef git_patch * Patch;
typedef git_push * Push;
typedef git_reference * Reference;
@@ -827,6 +828,7 @@ INCLUDE: xs/Diff/Delta.xs
INCLUDE: xs/Diff/File.xs
INCLUDE: xs/Diff/Hunk.xs
INCLUDE: xs/Index.xs
+INCLUDE: xs/Index/Entry.xs
INCLUDE: xs/Patch.xs
INCLUDE: xs/Push.xs
INCLUDE: xs/Reference.xs
View
39 lib/Git/Raw/Index/Entry.pm
@@ -0,0 +1,39 @@
+package Git::Raw::Index::Entry;
+
+use strict;
+use warnings;
+
+use Git::Raw;
+
+=head1 NAME
+
+Git::Raw::Index::Entry - Git index entry class
+
+=head1 DESCRIPTION
+
+A C<Git::Raw::Index::Entry> represents an index entry in a Git repository index.
+
+B<WARNING>: The API of this module is unstable and may change without warning
+(any change will be appropriately documented in the changelog).
+
+=head1 METHODS
+
+=head1 AUTHOR
+
+Alessandro Ghedini <alexbio@cpan.org>
+
+Jacques Germishuys <jacquesg@striata.com>
+
+=head1 LICENSE AND COPYRIGHT
+
+Copyright 2014 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.
+
+=cut
+
+1; # End of Git::Raw::Index::Entry
View
1 typemap
@@ -8,6 +8,7 @@ Diff_Delta T_GIT_REF
Diff_File T_GIT_REF
Diff_Hunk T_GIT_REF
Index T_GIT_REF
+Index_Entry T_GIT_REF
Patch T_GIT_REF
Push T_GIT_REF
Reflog T_GIT_REF
View
44 xs/Index/Entry.xs
@@ -0,0 +1,44 @@
+MODULE = Git::Raw PACKAGE = Git::Raw::Index::Entry
+
+SV *
+id(self)
+ Index_Entry self
+
+ CODE:
+ RETVAL = git_oid_to_sv(&self -> id);
+
+ OUTPUT: RETVAL
+
+SV *
+path(self)
+ Index_Entry self
+
+ CODE:
+ RETVAL = newSVpv(self -> path, 0);
+
+ OUTPUT: RETVAL
+
+SV *
+size(self)
+ Index_Entry self
+
+ CODE:
+ RETVAL = newSVuv(self -> file_size);
+
+ OUTPUT: RETVAL
+
+SV *
+stage(self)
+ Index_Entry self
+
+ CODE:
+ RETVAL = newSViv(git_index_entry_stage(self));
+
+ OUTPUT: RETVAL
+
+void
+DESTROY(self)
+ SV* self
+
+ CODE:
+ SvREFCNT_dec(GIT_SV_TO_MAGIC(self));

0 comments on commit b12e376

Please sign in to comment.
Something went wrong with that request. Please try again.