blib/lib/Git/Raw/Repository.pm

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 7 / 7 totaltotal 100% 41 / 41 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Git/Raw/Remote.pm ↑ Summary blib/lib/Git/Raw/Signature.pm »
1 package Git::Raw::Repository;
2 87 $Git::Raw::Repository::VERSION = '0.90';
3 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 87 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 87 ▶use Git::Raw;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Git::Raw::Repository - Git repository class
11  
12 =head1 VERSION
13  
14 version 0.90
15  
16 =head1 SYNOPSIS
17  
18 use Git::Raw;
19  
20 # clone a Git repository
21 my $url = 'git://github.com/jacquesg/p5-Git-Raw.git';
22 my $callbacks = {
23 'transfer_progress' => sub {
24 my ($total_objects, $received_objects, $local_objects, $total_deltas,
25 $indexed_deltas, $received_bytes) = @_;
26  
27 print "Objects: $received_objects/$total_objects", "\n";
28 print "Received: ", int($received_bytes/1024), "KB", "\n";
29 }
30 };
31 my $repo = Git::Raw::Repository -> clone($url, 'p5-Git-Raw', {}, {
32 'callbacks' => $callbacks
33 });
34  
35 # print all the tags of the repository
36 foreach my $tag ($repo -> tags) {
37 say $tag -> name;
38 }
39  
40 # merge a reference
41 my $ref = Git::Raw::Reference -> lookup('HEAD', $repo);
42 $repo -> merge ($ref);
43  
44 my @conflicts = $repo -> index -> conflicts;
45 print "Got ", scalar (@conflicts), " conflicts!\n";
46  
47 =head1 DESCRIPTION
48  
49 A L<Git::Raw::Repository> represents a Git repository.
50  
51 B<WARNING>: The API of this module is unstable and may change without warning
52 (any change will be appropriately documented in the changelog).
53  
54 =head1 METHODS
55  
56 =head2 init( $path, $is_bare )
57  
58 Initialize a new repository at C<$path>.
59  
60 =head2 clone( $url, $path, \%opts, [\%fetch_opts, \%checkout_opts])
61  
62 Clone the repository at C<$url> to C<$path>. Valid fields for the C<%opts> hash
63 are:
64  
65 =over 4
66  
67 =item * "bare"
68  
69 If true (default is false) create a bare repository.
70  
71 =item * "checkout_branch"
72  
73 The name of the branch to checkout (default is to use the remote's HEAD).
74  
75 =item * "disable_checkout"
76  
77 If true (default is false) files will not be checked out after the clone completes.
78  
79 =item * "callbacks"
80  
81 =over 8
82  
83 =item * "remote_create"
84  
85 Remote customization callback. If a non-default remote is required, i.e. a remote
86 with a remote name other than 'origin', this callback should be used. The callback
87 receives a L<Git::Raw::Repository> object, a string containing the default name
88 for the remote, typically 'origin', and a string containing the URL of the remote.
89 This callback should return a L<Git::Raw::Remote> object. The returned object and
90 the repository object passed to this callback are ephemeral. B<Note:> Do not take any
91 references to it, as it may be freed internally.
92  
93 =back
94  
95 =back
96  
97 See C<Git::Raw::Remote-E<gt>fetch()> for valid C<%fetch_opts> values and
98 C<Git::Raw::Repository-E<gt>checkout()> for valid C<%checkout_opts> values.
99  
100 =head2 open( $path )
101  
102 Open the repository at C<$path>.
103  
104 =head2 discover( $path )
105  
106 Discover the path to the repository directory given a subdirectory.
107  
108 =head2 new( )
109  
110 Create a new repository with neither backends nor config object.
111  
112 =head2 config( )
113  
114 Retrieve the default L<Git::Raw::Config> of the repository.
115  
116 =head2 commondir( )
117  
118 Get the path of the shared common directory for this repository.
119  
120 =head2 is_worktree( )
121  
122 Check if the repository is a linked work tree.
123  
124 =head2 index( [$new_index] )
125  
126 Retrieve the index of the repository. If C<$new_index> is passed, it will be used
127 as the index of the repository. If C<$new_index> is C<undef> the index associated
128 with the repository will be disassociated. Returns a L<Git::Raw::Index> object or
129 C<undef> if index has been disassociated as part of the call.
130  
131 =head2 odb( [$new_odb] )
132  
133 Retrieve the object database of the repository. If C<$odb> is passed, it will be
134 used as the object database. Returns a L<Git::Raw::Odb> object.
135  
136 =head2 head( [$new_head] )
137  
138 Retrieve the L<Git::Raw::Reference> pointed by the HEAD of the repository. If
139 the L<Git::Raw::Reference> C<$new_head> is passed, the HEAD of the repository
140 will be changed to point to it.
141  
142 =head2 head_for_worktree( $worktree )
143  
144 Retrieve the L<Git::Raw::Reference> pointed by the HEAD of C<$worktree>.
145  
146 =head2 detach_head( $commitish )
147  
148 Make the repository HEAD point directly to a commit. C<$commitish> should be
149 peelable to a L<Git::Raw::Commit> object, that is, it should be a
150 L<Git::Raw::Commit> or L<Git::Raw::Reference> object, or alternatively a commit
151 id or commit id prefix.
152  
153 =head2 lookup( $id )
154  
155 Retrieve the object corresponding to C<$id>.
156  
157 =head2 checkout( $object, \%opts )
158  
159 Updates the files in the index and working tree to match the content of
160 C<$object>. Valid fields for the C<%opts> hash are:
161  
162 =over 4
163  
164 =item * "checkout_strategy"
165  
166 Hash representing the desired checkout strategy. Valid fields are:
167  
168 =over 8
169  
170 =item * "none"
171  
172 Dry-run checkout strategy. It doesn't make any changes, but checks for
173 conflicts.
174  
175 =item * "force"
176  
177 Take any action to make the working directory match the target (pretty much the
178 opposite of C<"none">).
179  
180 =item * "safe_create"
181  
182 Recreate missing files.
183  
184 =item * "safe"
185  
186 Make only modifications that will not lose changes (to be used in order to
187 simulate C<git checkout>).
188  
189 =item * "allow_conflicts"
190  
191 Apply safe updates even if there are conflicts.
192  
193 =item * "remove_untracked"
194  
195 Remove untracked files from the working directory.
196  
197 =item * "remove_ignored"
198  
199 Remove ignored files from the working directory.
200  
201 =item * "update_only"
202  
203 Only update files that already exist (files won't be created or deleted).
204  
205 =item * "dont_update_index"
206  
207 Do not write the updated files' info to the index.
208  
209 =item * "dont_remove_existing"
210  
211 Don not overwrite existing files or folders.
212  
213 =item * "dont_write_index"
214  
215 Prevent writing of the index upon completion.
216  
217 =item * "no_refresh"
218  
219 Do not reload the index and git attrs from disk before operations.
220  
221 =item * "skip_unmerged"
222  
223 Skip files with unmerged index entries, instead of treating them as conflicts.
224  
225 =back
226  
227 =item * "notify"
228  
229 Notification flags for the notify callback. A list of the following options:
230  
231 =over 8
232  
233 =item * "conflict"
234  
235 Notifies about conflicting paths.
236  
237 =item * "dirty"
238  
239 Notifies about files that don't need an update but no longer match the baseline.
240 Core git displays these files when checkout runs, but won't stop the checkout.
241  
242 =item * "updated"
243  
244 Notification on any file changed.
245  
246 =item * "untracked"
247  
248 Notification about untracked files.
249  
250 =item * "ignored"
251  
252 Notifies about ignored files.
253  
254 =item * "all"
255  
256 All of the above.
257  
258 =back
259  
260 =item * "callbacks"
261  
262 Hash containing progress and notification callbacks. Valid fields are:
263  
264 =over 8
265  
266 =item * "notify"
267  
268 This callback is called for each file matching one of the C<notify> options
269 selected. It runs before modifying any files on disk. This callback should
270 return a non-zero value should the checkout be cancelled. The callback receives
271 a string containing the path of the file C<$path> and an array reference
272 containing the reason C<$why>.
273  
274 =item * "progress"
275  
276 The callback to be invoked as a file is checked out. The callback receives a
277 string containing the path of the file C<$path>, an integer C<$completed_steps>
278 and an integer C<$total_steps>.
279  
280 =back
281  
282 =item * "paths"
283  
284 An optional array representing the list of files that should be checked out. If
285 C<"paths"> is not specified, all files will be checked out (default).
286  
287 =item * "our_label"
288  
289 The name of the "our" side of conflicts.
290  
291 =item * "their_label"
292  
293 The name of the "their" side of conflicts.
294  
295 =item * "ancestor_label"
296  
297 The name of the common ancestor side of conflicts.
298  
299 =item * "target_directory"
300  
301 Alternative checkout path to the working directory.
302  
303 =back
304  
305 Example:
306  
307 $repo -> checkout($repo -> head -> target, {
308 'checkout_strategy' => { 'safe' => 1 },
309 'notify' => [ 'all' ],
310 'callbacks' => {
311 'notify' => sub {
312 my ($path, $why) = @_;
313  
314 print "File: $path: ", join(' ', @$why), "\n";
315 },
316 'progress' => sub {
317 my ($path, $completed_steps, $total_steps) = @_;
318  
319 print "File: $path", "\n" if defined ($path);
320 print "Progress: $completed_steps/$total_steps", "\n";
321 }
322 },
323 'paths' => [ 'myscript.pl' ]
324 });
325  
326 =head2 reset( $target, \%opts )
327  
328 Reset the current HEAD to the given commit. Valid fields for the C<%opts>
329 hash are:
330  
331 =over 4
332  
333 =item * "type"
334  
335 Set the type of the reset to be performed. Valid values are: C<"soft"> (the head
336 will be moved to the commit), C<"mixed"> (trigger a soft reset and replace the
337 index with the content of the commit tree) or C<"hard"> (trigger a C<"mixed">
338 reset and the working directory will be replaced with the content of the index).
339  
340 =item * "paths"
341  
342 List of entries in the index to be updated from the target commit tree. This is
343 particularly useful to implement C<"git reset HEAD -- file file"> behaviour.
344 Note, if this parameter is specified, a value of C<"mixed"> will be used for
345 C<"type"> (setting C<"type"> to C<"soft"> or C<"hard"> has no effect).
346  
347 =back
348  
349 =head2 status( \%opts, [$file, $file, ...] )
350  
351 Retrieve the status of files in the index and/or working directory. This function
352 returns a hash reference with an entry for each C<$file>, or all files if no file
353 parameters are provided. Each C<$file> entry has a list of C<"flags">, which may
354 include: C<"index_new">, C<"index_modified">, C<"index_deleted">, C<"index_renamed">,
355 C<"worktree_new">, C<"worktree_modified">, C<"worktree_deleted">,
356 C<"worktree_renamed">, C<"worktree_unreadable">, C<"conflicted"> and C<"ignored">.
357  
358 If C<$file> has been renamed in either the index or worktree or both, C<$file>
359 will also have a corresponding entry C<"index"> and/or C<"worktree">, containing
360 the previous filename C<"old_file">.
361  
362 Valid fields for the C<%opts> hash are:
363  
364 =over 4
365  
366 =item * "flags"
367  
368 Flags for the status. Valid values include:
369  
370 =over 8
371  
372 =item * "include_untracked"
373  
374 Callbacks should be made on untracked files. These will only be made if the
375 workdir files are included in the C<$show> option.
376  
377 =item * "include_ignored"
378  
379 Callbacks should be made on ignored files. These will only be made if the
380 ignored files get callbacks.
381  
382 =item * "include_unmodified"
383  
384 Include even unmodified files.
385  
386 =item * "exclude_submodules"
387  
388 Submodules should be skipped. This only applies if there are no pending
389 typechanges to the submodule (either from or to another type).
390  
391 =item * "recurse_untracked_dirs"
392  
393 All files in untracked directories should be included. Normally if an entire
394 directory is new, then just the top-level directory is included (with a
395 trailing slash on the entry name). This flag includes all of the individual
396 files in the directory instead.
397  
398 =item * "disable_pathspec_match"
399  
400 Each C<$file> specified should be treated as a literal path, and not as a
401 pathspec pattern.
402  
403 =item * "recurse_ignored_dirs"
404  
405 The contents of ignored directories should be included in the status. This is
406 like doing C<git ls-files -o -i --exclude-standard> with core git.
407  
408 =item * "renames_head_to_index"
409  
410 Rename detection should be processed between the head and the index.
411  
412 =item * "renames_index_to_workdir"
413  
414 Rename detection should be run between the index and the working directory.
415  
416 =item * "sort_case_sensitively"
417  
418 Override the native case sensitivity for the file system and force the output
419 to be in case-sensitive order.
420  
421 =item * "sort_case_insensitively"
422  
423 Override the native case sensitivity for the file system and force the output
424 to be in case-insensitive order.
425  
426 =item * "renames_from_rewrites"
427  
428 Rename detection should include rewritten files.
429  
430 =item * "no_refresh"
431  
432 Bypass the default status behavior of doing a "soft" index reload (i.e.
433 reloading the index data if the file on disk has been modified outside
434 C<Git::Raw>).
435  
436 =item * "update_index"
437  
438 Refresh the stat cache in the index for files that are unchanged but have
439 out-of-date stat information in the index. It will result in less work being done
440 on subsequent calls to C<status>. This is mutually exclusive with the
441 C<"no_refresh"> option.
442  
443 =item * "include_unreadable"
444  
445 Include unreadable files.
446  
447 =item * "include_unreadable_as_untracked"
448  
449 Include unreadable files as untracked files.
450  
451 =back
452  
453 =item * "show"
454  
455 One of the following values (Defaults to C<index_and_worktree>):
456  
457 =over 8
458  
459 =item * "index_and_worktree"
460  
461 =item * "index"
462  
463 =item * "worktree"
464  
465 =back
466  
467 =back
468  
469 Example:
470  
471 my $opts = {
472 'flags' => {
473 'include_untracked' => 1,
474 'renames_head_to_index' => 1,
475 'renames_index_to_workdir' => 1,
476 },
477 'show' => 'index_and_worktree'
478 };
479 my $file_statuses = $repo -> status($opts);
480 while (my ($file, $status) = each %$file_statuses) {
481 my $flags = $status -> {'flags'};
482 print "File: $file: Status: ", join (' ', @$flags), "\n";
483  
484 if (grep { $_ eq 'index_renamed' } @$flags) {
485 print "Index previous filename: ",
486 $status -> {'index'} -> {'old_file'}, "\n";
487 }
488  
489 if (grep { $_ eq 'worktree_renamed' } @$flags) {
490 print "Worktree previous filename: ",
491 $status -> {'worktree'} -> {'old_file'}, "\n";
492 }
493 }
494  
495 =head2 merge_base( @objects )
496  
497 Find the merge base between C<@objects>. Each element in C<@objects> should be
498 peelable to a L<Git::Raw::Commit> object, that is, it should be a
499 L<Git::Raw::Commit> or L<Git::Raw::Reference> object, or alternatively a commit
500 id or commit id prefix.
501  
502 =head2 merge_analysis( $reference )
503  
504 Analyzes the given C<$reference> and determines the opportunities for merging
505 them into the HEAD of the repository. This function returns an array reference
506 with optional members C<"normal">, C<"up_to_date">, C<"fast_forward"> and/or
507 C<"unborn">.
508  
509 =over 4
510  
511 =item * "normal"
512  
513 A "normal" merge. Both HEAD and the given merge input have diverged from their
514 common ancestor. The divergent commits must be merged.
515  
516 =item * "up_to_date"
517  
518 All given merge inputs are reachable from HEAD, meaning the repository is
519 up-to-date and no merge needs to be performed.
520  
521 =item * "fast_forward"
522  
523 The given merge input is a fast-forward from HEAD and no merge needs to be
524 performed. Instead, the given merge input may be checked out.
525  
526 =item * "unborn"
527  
528 The HEAD of the current repository is "unborn" and does not point to a valid
529 commit. No merge can be performed, but the caller may wish to simply set
530 HEAD to the target commit(s).
531  
532 =back
533  
534 =head2 merge( $ref, [\%merge_opts, \%checkout_opts])
535  
536 Merge the given C<$ref> into HEAD, writing the results into the working
537 directory. Any changes are staged for commit and any conflicts are written
538 to the index. The index should be inspected for conflicts after this method
539 completes and any conflicts should be resolved. At this stage a commit
540 may be created to finalise the merge.
541  
542 =over 4
543  
544 =item * "flags"
545  
546 Merge flags. Valid values include:
547  
548 =over 8
549  
550 =item * "find_renames"
551  
552 Detect renames.
553  
554 =back
555  
556 =item * "file_flags"
557  
558 See C<Git::Raw::Index-E<gt>merge()> for options.
559  
560 =item * "favor"
561  
562 Specify content automerging behaviour. Valid values are C<"ours">, C<"theirs">,
563 and C<"union">.
564  
565 =item * "rename_threshold"
566  
567 Similarity metric for considering a file renamed (default is 50).
568  
569 =item * "target_limit"
570  
571 Maximum similarity sources to examine (overrides the C<"merge.renameLimit">
572 configuration entry) (default is 200).
573  
574 =back
575  
576 Example:
577  
578 my $branch = Git::Raw::Branch -> lookup($repo, 'branch', 1);
579 my $analysis = $repo -> merge_analysis($branch);
580 my $merge_opts = {
581 'favor' => 'theirs'
582 };
583 my $checkout_opts = {
584 'checkout_strategy' => {
585 'force' => 1
586 }
587 };
588 $repo -> merge($branch1, $merge_opts, $checkout_opts);
589  
590 =head2 ignore( $rules )
591  
592 Add an ignore rules to the repository. The format of the rules is the same one
593 of the C<.gitignore> file (see the C<gitignore(5)> manpage). Example:
594  
595 $repo -> ignore("*.o\n");
596  
597 =head2 path_is_ignored( $path )
598  
599 Checks the ignore rules to see if they would apply to the given file. This indicates
600 if the file would be ignored regardless of whether the file is already in the index
601 or committed to the repository.
602  
603 =head2 diff( [\%diff_opts] )
604  
605 Compute the L<Git::Raw::Diff> between the repo's default index and another tree.
606 Valid fields for the C<%diff_opts> hash are:
607  
608 =over 4
609  
610 =item * "tree"
611  
612 If provided, the diff is computed between C<"tree"> and the repo's default index.
613 The default is the repo's working directory.
614  
615 =item * "flags"
616  
617 Flags for generating the diff. Valid values include:
618  
619 =over 8
620  
621 =item * "reverse"
622  
623 Reverse the sides of the diff.
624  
625 =item * "include_ignored"
626  
627 Include ignored files in the diff.
628  
629 =item * "include_typechange"
630  
631 Enable the generation of typechange delta records.
632  
633 =item * "recurse_ignored_dirs"
634  
635 Even if C<"include_ignored"> is specified, an entire ignored directory
636 will be marked with only a single entry in the diff. This flag adds all files
637 under the directory as ignored entries, too.
638  
639 =item * "include_untracked"
640  
641 Include untracked files in the diff.
642  
643 =item * "recurse_untracked_dirs"
644  
645 Even if C<"include_untracked"> is specified, an entire untracked directory
646 will be marked with only a single entry in the diff (core git behaviour).
647 This flag adds all files under untracked directories as untracked entries, too.
648  
649 =item * "ignore_filemode"
650  
651 Ignore file mode changes.
652  
653 =item * "ignore_case"
654  
655 Use case insensitive filename comparisons.
656  
657 =item * "ignore_submodules"
658  
659 Treat all submodules as unmodified.
660  
661 =item * "ignore_whitespace"
662  
663 Ignore all whitespace.
664  
665 =item * "ignore_whitespace_change"
666  
667 Ignore changes in amount of whitespace.
668  
669 =item * "ignore_whitespace_eol"
670  
671 Ignore whitespace at end of line.
672  
673 =item * "skip_binary_check"
674  
675 Disable updating of the binary flag in delta records. This is useful when
676 iterating over a diff if you don't need hunk and data callbacks and want to avoid
677 having to load file completely.
678  
679 =item * "enable_fast_untracked_dirs"
680  
681 When diff finds an untracked directory, to match the behavior of core git, it
682 scans the contents for ignored and untracked files. If all contents are ignore,
683 then the directory is ignored. If any contents are not ignored, then the
684 directory is untracked. This is extra work that may not matter in many cases.
685 This flag turns off that scan and immediately labels an untracked directory
686 as untracked (changing the behavior to not match core git).
687  
688 =item * "show_untracked_content"
689  
690 Include the content of untracked files. This implies C<"include_untracked">.
691  
692 =item * "show_unmodified"
693  
694 Include the names of unmodified files.
695  
696 =item * "patience"
697  
698 Use the C<"patience diff"> algorithm.
699  
700 =item * "minimal"
701  
702 Take extra time to find minimal diff.
703  
704 =item * "show_binary"
705  
706 Include the necessary deflate / delta information so that C<git apply> can
707 apply given diff information to binary files.
708  
709 =item * "force_text"
710  
711 Treat all files as text, disabling binary attributes and detection.
712  
713 =item * "force_binary"
714  
715 Treat all files as binary, disabling text diffs.
716  
717 =back
718  
719 =item * "prefix"
720  
721 =over 8
722  
723 =item * "a"
724  
725 The virtual C<"directory"> to prefix to old file names in hunk headers.
726 (Default is C<"a">.)
727  
728 =item * "b"
729  
730 The virtual C<"directory"> to prefix to new file names in hunk headers.
731 (Default is C<"b">.)
732  
733 =back
734  
735 =item * "context_lines"
736  
737 The number of unchanged lines that define the boundary of a hunk (and
738 to display before and after)
739  
740 =item * "interhunk_lines"
741  
742 The maximum number of unchanged lines between hunk boundaries before
743 the hunks will be merged into a one.
744  
745 =item * "paths"
746  
747 A list of paths to constrain diff.
748  
749 =back
750  
751 =head2 blob( $buffer )
752  
753 Create a new L<Git::Raw::Blob>. Shortcut for C<Git::Raw::Blob-E<gt>create()>.
754  
755 =cut
756  
757 3 ▶sub blob { return Git::Raw::Blob -> create(@_) }
Subroutine blob: called CC=1 SCAR=0.0
Pod documented
758  
759 =head2 branch( $name, $target )
760  
761 Create a new L<Git::Raw::Branch>. Shortcut for C<Git::Raw::Branch-E<gt>create()>.
762  
763 =cut
764  
765 14 ▶sub branch { return Git::Raw::Branch -> create(@_) }
Subroutine branch: called CC=1 SCAR=0.0
Pod documented
766  
767 =head2 branches( [$type] )
768  
769 Retrieve a list of L<Git::Raw::Branch> objects. Possible values for C<$type>
770 include C<"local">, C<"remote"> or C<"all">.
771  
772 =head2 commit( $msg, $author, $committer, \@parents, $tree [, $update_ref ] )
773  
774 Create a new L<Git::Raw::Commit>. Shortcut for C<Git::Raw::Commit-E<gt>create()>.
775  
776 =cut
777  
778 26 ▶sub commit { return Git::Raw::Commit -> create(@_) }
Subroutine commit: called CC=1 SCAR=0.0
Pod documented
779  
780 =head2 tag( $name, $msg, $tagger, $target )
781  
782 Create a new L<Git::Raw::Tag>. Shortcut for C<Git::Raw::Tag-E<gt>create()>.
783  
784 =cut
785  
786 1 ▶sub tag { return Git::Raw::Tag -> create(@_) }
Subroutine tag: called CC=1 SCAR=0.0
Pod documented
787  
788 =head2 tags( [$type] )
789  
790 Retrieve the list of annotated and/or lightweight tag objects. Possible values
791 for C<$type> include C<"all">, C<"annotated"> or C<"lightweight">.
792  
793 =cut
794  
795 9 ▶sub tags {
Subroutine tags: called CC=1 SCAR=0.0
Pod documented
796 9 my $self = shift;
797  
798 9 my @tags;
799  
800 5 ▶ Git::Raw::Tag -> foreach($self, sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
801 5 push @tags, shift; 0
802 9 }, @_);
803  
804 8 return @tags;
805 }
806  
807 =head2 stash( $repo, $msg )
808  
809 Save the local modifications to a new stash. Shortcut for C<Git::Raw::Stash-E<gt>save()>.
810  
811 =cut
812  
813 8 ▶sub stash { return Git::Raw::Stash -> save(@_) }
Subroutine stash: called CC=1 SCAR=0.0
Pod documented
814  
815 =head2 remotes( )
816  
817 Retrieve the list of L<Git::Raw::Remote> objects.
818  
819 =head2 refs( )
820  
821 Retrieve the list of L<Git::Raw::Reference> objects.
822  
823 =head2 walker( )
824  
825 Create a new L<Git::Raw::Walker>. Shortcut for C<Git::Raw::Walker-E<gt>create()>.
826  
827 =cut
828  
829 1 ▶sub walker { return Git::Raw::Walker -> create(@_) }
Subroutine walker: called CC=1 SCAR=0.0
Pod documented
830  
831 =head2 path( )
832  
833 Retrieve the complete path of the repository.
834  
835 =head2 workdir( [$new_dir] )
836  
837 Retrieve the working directory of the repository. If C<$new_dir> is passed, the
838 working directory of the repository will be set to the directory.
839  
840 =head2 blame( $path )
841  
842 Retrieve blame information for C<$path>. Returns a L<Git::Raw::Blame> object.
843  
844 =head2 cherry_pick( $commit, [\%merge_opts, \%checkout_opts, $mainline] )
845  
846 Cherry-pick the given C<$commit>, producing changes in the index and working
847 directory. See C<Git::Raw::Repository-E<gt>merge()> for valid C<%merge_opts>
848 and C<%checkout_opts> values. For merge commits C<$mainline> specifies the
849 parent.
850  
851 =head2 revert( $commit, [\%merge_opts, \%checkout_opts, $mainline] )
852  
853 Revert the given C<$commit>, producing changes in the index and working
854 directory. See C<Git::Raw::Repository-E<gt>merge()> for valid C<%merge_opts>
855 and C<%checkout_opts> values. For merge commits C<$mainline> specifies the
856 parent.
857  
858 =head2 revparse( $spec )
859  
860 Parse the revision string C<$spec> to for C<from>, C<to> and C<intent>. Returns a
861 list of objects in list context and the number of objects parsed from C<$spec>
862 in scalar context.
863  
864 my ($from, $to) = $repo -> revparse('HEAD~..HEAD');
865 print "Range is $from -> $to", "\n";
866  
867 =head2 state( )
868  
869 Determine the state of the repository. One of the following values is returned:
870  
871 =over 4
872  
873 =item * "none"
874  
875 Normal state
876  
877 =item * "merge"
878  
879 Repository is in a merge.
880  
881 =item * "revert"
882  
883 Repository is in a revert.
884  
885 =item * "cherry_pick"
886  
887 Repository is in a cherry-pick.
888  
889 =item * "bisect"
890  
891 Repository is bisecting.
892  
893 =item * "rebase"
894  
895 Repository is rebasing.
896  
897 =item * "rebase_interactive"
898  
899 Repository is in an interactive rebase.
900  
901 =item * "rebase_merge"
902  
903 Repository is in an rebase merge.
904  
905 =item * "apply_mailbox"
906  
907 Repository is applying patches.
908  
909 =item * "mailbox_or_rebase"
910  
911 Repository is applying patches or rebasing.
912  
913 =back
914  
915 =head2 state_cleanup( )
916  
917 Remove all the metadata associated with an ongoing command like merge, revert,
918 cherry-pick, etc.
919  
920 =head2 message( )
921  
922 Retrieve the content of git's prepared message i.e. C<".git/MERGE_MSG">.
923  
924 =head2 is_empty( )
925  
926 Check if the repository is empty.
927  
928 =head2 is_bare( )
929  
930 Check if the repository is bare.
931  
932 =head2 is_shallow( )
933  
934 Check if the repository is a shallow clone.
935  
936 =head2 is_head_detached( )
937  
938 Check if the repository's C<HEAD> is detached, that is, it points directly to
939 a commit.
940  
941 =head1 AUTHOR
942  
943 Alessandro Ghedini <alexbio@cpan.org>
944  
945 Jacques Germishuys <jacquesg@cpan.org>
946  
947 =head1 LICENSE AND COPYRIGHT
948  
949 Copyright 2012 Alessandro Ghedini.
950  
951 This program is free software; you can redistribute it and/or modify it
952 under the terms of either: the GNU General Public License as published
953 by the Free Software Foundation; or the Artistic License.
954  
955 See http://dev.perl.org/licenses/ for more information.
956  
957 =cut
958  
959 87 1; # End of Git::Raw::Repository
« blib/lib/Git/Raw/Remote.pm ↑ Summary blib/lib/Git/Raw/Signature.pm »