File Coverage

blib/lib/Git/Raw/Reference.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Git::Raw::Reference;
2             $Git::Raw::Reference::VERSION = '0.90';
3 36     36   218 use strict;
  36         65  
  36         929  
4 36     36   168 use warnings;
  36         61  
  36         779  
5              
6 36     36   162 use Git::Raw;
  36         59  
  36         2293  
7              
8             =head1 NAME
9              
10             Git::Raw::Reference - Git reference class
11              
12             =head1 VERSION
13              
14             version 0.90
15              
16             =head1 DESCRIPTION
17              
18             A L represents a Git reference.
19              
20             B: The API of this module is unstable and may change without warning
21             (any change will be appropriately documented in the changelog).
22              
23             =head1 METHODS
24              
25             =head2 annotated_commit( )
26              
27             Create a L from the reference.
28              
29             =head2 lookup( $name, $repo )
30              
31             Retrieve the reference with name C<$name> in C<$repo>.
32              
33             =head2 create( $name, $repo, $object [, $force, $symbolic] )
34              
35             Creates and returns a new reference named C<$name> in C<$repo> pointing
36             to C<$object>. C<$object> can be a L, L,
37             or a L object. If C<$force> is a truthy value, any existing
38             reference is overwritten. If C<$force> is falsy (the default) and a reference
39             named C<$name> already exists, an error is thrown. If C<$symbolic> is a truthy
40             value, then a symbolic reference is created. If C<$symbolic> is falsy
41             (the default), then a direct reference is created. If C<$symbolic> is a truthy
42             value, then C<$object> can be a L or a string.
43              
44             =head2 delete( )
45              
46             Delete the reference. The L object must not be accessed
47             afterwards.
48              
49             =head2 name( )
50              
51             Retrieve the name of the reference.
52              
53             =head2 shorthand( )
54              
55             Get the reference's short name. This will transform the reference name into a
56             "human-readable" version. If no shortname is appropriate, it will return the
57             full name.
58              
59             =head2 type( )
60              
61             Retrieve the type of the reference. Can be either C<"direct"> or C<"symbolic">.
62              
63             =head2 target( [$new_target] )
64              
65             Retrieve the target of the reference. If the C<$new_target> parameter of type
66             L is passed, the reference will be changed to point to it.
67              
68             Note that updating the target will invalidate all existing handles to the
69             reference.
70              
71             This function returns either an object (L, L,
72             L or L) for direct references, or another
73             reference for symbolic references.
74              
75             =head2 peel( $type )
76              
77             Recursively peel the reference until an object of the specified C<$type> is
78             found. Valid values for C<$type> include: C<"commit">, C<"tree"> or C<"tag">.
79              
80             =head2 reflog( )
81              
82             Retrieve the L of the reference. Shortcut for
83             Copen()>.
84              
85             =cut
86              
87 3     3 1 20518 sub reflog { return Git::Raw::Reflog -> open (shift); }
88              
89             =head2 owner( )
90              
91             Retrieve the L owning the reference.
92              
93             =head2 is_branch( )
94              
95             Check if the reference is a branch.
96              
97             =head2 is_remote( )
98              
99             Check if the reference is remote.
100              
101             =head2 is_tag( )
102              
103             Check if the reference lives in the Ctags> namespace.
104              
105             =head2 is_note( )
106              
107             Check if the reference lives in the Cnotes> namespace.
108              
109             =head1 AUTHOR
110              
111             Alessandro Ghedini
112              
113             Jacques Germishuys
114              
115             =head1 LICENSE AND COPYRIGHT
116              
117             Copyright 2012 Alessandro Ghedini.
118              
119             This program is free software; you can redistribute it and/or modify it
120             under the terms of either: the GNU General Public License as published
121             by the Free Software Foundation; or the Artistic License.
122              
123             See http://dev.perl.org/licenses/ for more information.
124              
125             =cut
126              
127             1; # End of Git::Raw::Reference