.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Git::Raw::Repository 3pm" .TH Git::Raw::Repository 3pm "2019-01-12" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Git::Raw::Repository \- Git repository class .SH "VERSION" .IX Header "VERSION" version 0.79 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Git::Raw; \& \& # clone a Git repository \& my $url = \*(Aqgit://github.com/jacquesg/p5\-Git\-Raw.git\*(Aq; \& my $callbacks = { \& \*(Aqtransfer_progress\*(Aq => sub { \& my ($total_objects, $received_objects, $local_objects, $total_deltas, \& $indexed_deltas, $received_bytes) = @_; \& \& print "Objects: $received_objects/$total_objects", "\en"; \& print "Received: ", int($received_bytes/1024), "KB", "\en"; \& } \& }; \& my $repo = Git::Raw::Repository \-> clone($url, \*(Aqp5\-Git\-Raw\*(Aq, {}, { \& \*(Aqcallbacks\*(Aq => $callbacks \& }); \& \& # print all the tags of the repository \& foreach my $tag ($repo \-> tags) { \& say $tag \-> name; \& } \& \& # merge a reference \& my $ref = Git::Raw::Reference \-> lookup(\*(AqHEAD\*(Aq, $repo); \& $repo \-> merge ($ref); \& \& my @conflicts = $repo \-> index \-> conflicts; \& print "Got ", scalar (@conflicts), " conflicts!\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A Git::Raw::Repository represents a Git repository. .PP \&\fB\s-1WARNING\s0\fR: The \s-1API\s0 of this module is unstable and may change without warning (any change will be appropriately documented in the changelog). .SH "METHODS" .IX Header "METHODS" .ie n .SS "init( $path, $is_bare )" .el .SS "init( \f(CW$path\fP, \f(CW$is_bare\fP )" .IX Subsection "init( $path, $is_bare )" Initialize a new repository at \f(CW$path\fR. .ie n .SS "clone( $url, $path, \e%opts, [\e%fetch_opts, \e%checkout_opts])" .el .SS "clone( \f(CW$url\fP, \f(CW$path\fP, \e%opts, [\e%fetch_opts, \e%checkout_opts])" .IX Subsection "clone( $url, $path, %opts, [%fetch_opts, %checkout_opts])" Clone the repository at \f(CW$url\fR to \f(CW$path\fR. Valid fields for the \f(CW%opts\fR hash are: .IP "\(bu" 4 \&\*(L"bare\*(R" .Sp If true (default is false) create a bare repository. .IP "\(bu" 4 \&\*(L"checkout_branch\*(R" .Sp The name of the branch to checkout (default is to use the remote's \s-1HEAD\s0). .IP "\(bu" 4 \&\*(L"disable_checkout\*(R" .Sp If true (default is false) files will not be checked out after the clone completes. .IP "\(bu" 4 \&\*(L"callbacks\*(R" .RS 4 .IP "\(bu" 8 \&\*(L"remote_create\*(R" .Sp Remote customization callback. If a non-default remote is required, i.e. a remote with a remote name other than 'origin', this callback should be used. The callback receives a Git::Raw::Repository object, a string containing the default name for the remote, typically 'origin', and a string containing the \s-1URL\s0 of the remote. This callbacks should return a Git::Raw::Remote object. The returned object and the repository object passed to this callback is ephemeral. \fBNote:\fR Do not take any references to it as it may be freed internally. .RE .RS 4 .RE .PP See \f(CW\*(C`Git::Raw::Remote\->fetch()\*(C'\fR for valid \f(CW%fetch_opts\fR values and \&\f(CW\*(C`Git::Raw::Repository\->checkout()\*(C'\fR for valid \f(CW%checkout_opts\fR values. .ie n .SS "open( $path )" .el .SS "open( \f(CW$path\fP )" .IX Subsection "open( $path )" Open the repository at \f(CW$path\fR. .ie n .SS "discover( $path )" .el .SS "discover( \f(CW$path\fP )" .IX Subsection "discover( $path )" Discover the path to the repository directory given a subdirectory. .SS "new( )" .IX Subsection "new( )" Create a new repository with neither backends nor config object. .SS "config( )" .IX Subsection "config( )" Retrieve the default Git::Raw::Config of the repository. .SS "commondir( )" .IX Subsection "commondir( )" Get the path of the shared common directory for this repository. .SS "is_worktree( )" .IX Subsection "is_worktree( )" Check if the repository is a linked work tree. .SS "index( [$new_index] )" .IX Subsection "index( [$new_index] )" Retrieve the index of the repository. If \f(CW$new_index\fR is passed, it will be used as the index of the repository. If \f(CW$new_index\fR is \f(CW\*(C`undef\*(C'\fR the index associated with the repository will be disassociated. Returns a Git::Raw::Index object or undef if index has been disassociated as part of the call. .SS "odb( [$new_odb] )" .IX Subsection "odb( [$new_odb] )" Retrieve the object database of the repository. If \f(CW$odb\fR is passed, it will be used as the object database. Returns a Git::Raw::Odb object. .SS "head( [$new_head] )" .IX Subsection "head( [$new_head] )" Retrieve the Git::Raw::Reference pointed by the \s-1HEAD\s0 of the repository. If the Git::Raw::Reference \f(CW$new_head\fR is passed, the \s-1HEAD\s0 of the repository will be changed to point to it. .ie n .SS "head_for_worktree( $worktree )" .el .SS "head_for_worktree( \f(CW$worktree\fP )" .IX Subsection "head_for_worktree( $worktree )" Retrieve the Git::Raw::Reference pointed by the \s-1HEAD\s0 of \f(CW$worktree\fR. .ie n .SS "detach_head( $commitish )" .el .SS "detach_head( \f(CW$commitish\fP )" .IX Subsection "detach_head( $commitish )" Make the repository \s-1HEAD\s0 point directly to a commit. \f(CW$commitish\fR should be peelable to a Git::Raw::Commit object, that is, it should be a Git::Raw::Commit or Git::Raw::Reference object, or alternatively a commit id or commit id prefix. .ie n .SS "lookup( $id )" .el .SS "lookup( \f(CW$id\fP )" .IX Subsection "lookup( $id )" Retrieve the object corresponding to \f(CW$id\fR. .ie n .SS "checkout( $object, \e%opts )" .el .SS "checkout( \f(CW$object\fP, \e%opts )" .IX Subsection "checkout( $object, %opts )" Updates the files in the index and working tree to match the content of \&\f(CW$object\fR. Valid fields for the \f(CW%opts\fR hash are: .IP "\(bu" 4 \&\*(L"checkout_strategy\*(R" .Sp Hash representing the desired checkout strategy. Valid fields are: .RS 4 .IP "\(bu" 8 \&\*(L"none\*(R" .Sp Dry-run checkout strategy. It doesn't make any changes, but checks for conflicts. .IP "\(bu" 8 \&\*(L"force\*(R" .Sp Take any action to make the working directory match the target (pretty much the opposite of \f(CW"none"\fR. .IP "\(bu" 8 \&\*(L"safe_create\*(R" .Sp Recreate missing files. .IP "\(bu" 8 \&\*(L"safe\*(R" .Sp Make only modifications that will not lose changes (to be used in order to simulate \f(CW\*(C`git checkout\*(C'\fR. .IP "\(bu" 8 \&\*(L"allow_conflicts\*(R" .Sp Apply safe updates even if there are conflicts. .IP "\(bu" 8 \&\*(L"remove_untracked\*(R" .Sp Remove untracked files from the working directory. .IP "\(bu" 8 \&\*(L"remove_ignored\*(R" .Sp Remove ignored files from the working directory. .IP "\(bu" 8 \&\*(L"update_only\*(R" .Sp Only update files that already exists (files won't be created not deleted). .IP "\(bu" 8 \&\*(L"dont_update_index\*(R" .Sp Do not write the updated files' info to the index. .IP "\(bu" 8 \&\*(L"dont_remove_existing\*(R" .Sp Don not overwrite existing files or folders. .IP "\(bu" 8 \&\*(L"dont_write_index\*(R" .Sp Prevent writing of the index upon completion. .IP "\(bu" 8 \&\*(L"no_refresh\*(R" .Sp Do not reload the index and git attrs from disk before operations. .IP "\(bu" 8 \&\*(L"skip_unmerged\*(R" .Sp Skip files with unmerged index entries, instead of treating them as conflicts. .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"notify\*(R" .Sp Notification flags for the notify callback. A list of the following options: .RS 4 .IP "\(bu" 8 \&\*(L"conflict\*(R" .Sp Notifies about conflicting paths. .IP "\(bu" 8 \&\*(L"dirty\*(R" .Sp Notifies about file that don't need an update but no longer matches the baseline. Core git displays these files when checkout runs, but won't stop the checkout. .IP "\(bu" 8 \&\*(L"updated\*(R" .Sp Notification on any file changed. .IP "\(bu" 8 \&\*(L"untracked\*(R" .Sp Notification about untracked files. .IP "\(bu" 8 \&\*(L"ignored\*(R" .Sp Notifies about ignored files. .IP "\(bu" 8 \&\*(L"all\*(R" .Sp All of the above. .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"callbacks\*(R" .Sp Hash containing progress and notification callbacks. Valid fields are: .RS 4 .IP "\(bu" 8 \&\*(L"notify\*(R" .Sp This callback is called for each file matching one of the \f(CW\*(C`notify\*(C'\fR options selected. It runs before modifying any files on disk. This callback should return a non-zero value should the checkout be cancelled. The callback receives a string containing the path of the file \f(CW$path\fR and an array reference containing the reason \f(CW$why\fR. .IP "\(bu" 8 \&\*(L"progress\*(R" .Sp The callback to be invoked as a file is checked out. The callback receives a string containing the path of the file \f(CW$path\fR, an integer \f(CW$completed_steps\fR and an integer \f(CW$total_steps\fR. .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"paths\*(R" .Sp An optional array representing the list of files thay should be checked out. If \&\f(CW"paths"\fR is not specified, all files will be checked out (default). .IP "\(bu" 4 \&\*(L"our_label\*(R" .Sp The name of the \*(L"our\*(R" side of conflicts. .IP "\(bu" 4 \&\*(L"their_label\*(R" .Sp The name of the \*(L"their\*(R" side of conflicts. .IP "\(bu" 4 \&\*(L"ancestor_label\*(R" .Sp The name of the common ancestor side of conflicts. .IP "\(bu" 4 \&\*(L"target_directory\*(R" .Sp Alternative checkout path to the working directory. .PP Example: .PP .Vb 6 \& $repo \-> checkout($repo \-> head \-> target, { \& \*(Aqcheckout_strategy\*(Aq => { \*(Aqsafe\*(Aq => 1 }, \& \*(Aqnotify\*(Aq => [ \*(Aqall\*(Aq ], \& \*(Aqcallbacks\*(Aq => { \& \*(Aqnotify\*(Aq => sub { \& my ($path, $why) = @_; \& \& print "File: $path: ", join(\*(Aq \*(Aq, @$why), "\en"; \& }, \& \*(Aqprogress\*(Aq => sub { \& my ($path, $completed_steps, $total_steps) = @_; \& \& print "File: $path", "\en" if defined ($path); \& print "Progress: $completed_steps/$total_steps", "\en"; \& } \& }, \& \*(Aqpaths\*(Aq => [ \*(Aqmyscript.pl\*(Aq ] \& }); .Ve .ie n .SS "reset( $target, \e%opts )" .el .SS "reset( \f(CW$target\fP, \e%opts )" .IX Subsection "reset( $target, %opts )" Reset the current \s-1HEAD\s0 to the given commit. Valid fields for the \f(CW%opts\fR hash are: .IP "\(bu" 4 \&\*(L"type\*(R" .Sp Set the type of the reset to be performed. Valid values are: \f(CW"soft"\fR (the head will be moved to the commit), \f(CW"mixed"\fR (trigger a soft reset and replace the index with the content of the commit tree) or \f(CW"hard"\fR (trigger a \f(CW"mixed"\fR reset and the working directory will be replaced with the content of the index). .IP "\(bu" 4 \&\*(L"paths\*(R" .Sp List of entries in the index to be updated from the target commit tree. This is particularly useful to implement \f(CW"git reset HEAD \-\- file file"\fR behaviour. Note, if this parameter is specified, a value of \f(CW"mixed"\fR will be used for \&\f(CW"type"\fR (setting \f(CW"type"\fR to \f(CW"soft"\fR or \f(CW"hard"\fR has no effect). .ie n .SS "status( \e%opts, [$file, $file, ...] )" .el .SS "status( \e%opts, [$file, \f(CW$file\fP, ...] )" .IX Subsection "status( %opts, [$file, $file, ...] )" Retrieve the status of files in the index and/or working directory. This functions returns a hash reference with an entry for each \f(CW$file\fR, or all files if no file parameters are provided. Each \f(CW$file\fR entry has a list of \f(CW"flags"\fR, which may include: \f(CW"index_new"\fR, \f(CW"index_modified"\fR, \f(CW"index_deleted"\fR, \f(CW"index_renamed"\fR, \&\f(CW"worktree_new"\fR, \f(CW"worktree_modified"\fR, \f(CW"worktree_deleted"\fR, \&\f(CW"worktree_renamed"\fR, \f(CW"worktree_unreadable"\fR, \f(CW"conflicted"\fR and \f(CW"ignored"\fR. .PP If \f(CW$file\fR has been renamed in either the index or worktree or both, \f(CW$file\fR will also have a corresponding entry \f(CW"index"\fR and/or \f(CW"worktree"\fR, containing the previous filename \f(CW"old_file"\fR. .PP Valid fields for the \f(CW%opts\fR hash are: .IP "\(bu" 4 \&\*(L"flags\*(R" .Sp Flags for the status. Valid values include: .RS 4 .IP "\(bu" 8 \&\*(L"include_untracked\*(R" .Sp Callbacks should be made on untracked files. These will only be made if the workdir files are included in the \f(CW$show\fR option. .IP "\(bu" 8 \&\*(L"include_ignored\*(R" .Sp Callbacks should be made on ignored files. These will only be made if the ignored files get callbacks. .IP "\(bu" 8 \&\*(L"include_unmodified\*(R" .Sp Include even unmodified files. .IP "\(bu" 8 \&\*(L"exclude_submodules\*(R" .Sp Submodules should be skipped. This only applies if there are no pending typechanges to the submodule (either from or to another type). .IP "\(bu" 8 \&\*(L"recurse_untracked_dirs\*(R" .Sp All files in untracked directories should be included. Normally if an entire directory is new, then just the top-level directory is included (with a trailing slash on the entry name). This flag includes all of the individual files in the directory instead. .IP "\(bu" 8 \&\*(L"disable_pathspec_match\*(R" .Sp Each \f(CW$file\fR specified should be treated as a literal path, and not as a pathspec pattern. .IP "\(bu" 8 \&\*(L"recurse_ignored_dirs\*(R" .Sp The contents of ignored directories should be included in the status. This is like doing \f(CW\*(C`git ls\-files \-o \-i \-\-exclude\-standard\*(C'\fR with core git. .IP "\(bu" 8 \&\*(L"renames_head_to_index\*(R" .Sp Rename detection should be processed between the head and the index. .IP "\(bu" 8 \&\*(L"renames_index_to_workdir\*(R" .Sp Rename detection should be run between the index and the working directory. .IP "\(bu" 8 \&\*(L"sort_case_sensitively\*(R" .Sp Override the native case sensitivity for the file system and forces the output to be in case-sensitive order. .IP "\(bu" 8 \&\*(L"sort_case_insensitively\*(R" .Sp Override the native case sensitivity for the file system and forces the output to be in case-insensitive order. .IP "\(bu" 8 \&\*(L"renames_from_rewrites\*(R" .Sp Rename detection should include rewritten files. .IP "\(bu" 8 \&\*(L"no_refresh\*(R" .Sp Bypass the default status behavior of doing a \*(L"soft\*(R" index reload (i.e. reloading the index data if the file on disk has been modified outside \&\f(CW\*(C`Git::Raw\*(C'\fR). .IP "\(bu" 8 \&\*(L"update_index\*(R" .Sp Refresh the stat cache in the index for files that are unchanged but have out of date stat information in the index. It will result in less work being done on subsequent calls to \f(CW\*(C`status\*(C'\fR. This is mutually exclusive with the \&\f(CW"no_refresh"\fR option. .IP "\(bu" 8 \&\*(L"include_unreadable\*(R" .Sp Include unreadable files. .IP "\(bu" 8 \&\*(L"include_unreadable_as_untracked\*(R" .Sp Include unreadable files as untracked files. .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"show\*(R" .Sp One of the following values (Defaults to \f(CW\*(C`index_and_worktree\*(C'\fR): .RS 4 .IP "\(bu" 8 \&\*(L"index_and_worktree\*(R" .IP "\(bu" 8 \&\*(L"index\*(R" .IP "\(bu" 8 \&\*(L"worktree\*(R" .RE .RS 4 .RE .PP Example: .PP .Vb 12 \& my $opts = { \& \*(Aqflags\*(Aq => { \& \*(Aqinclude_untracked\*(Aq => 1, \& \*(Aqrenames_head_to_index\*(Aq => 1, \& \*(Aqrenames_index_to_workdir\*(Aq => 1, \& }, \& \*(Aqshow\*(Aq => \*(Aqindex_and_worktree\*(Aq \& }; \& my $file_statuses = $repo \-> status($opts); \& while (my ($file, $status) = each %$file_statuses) { \& my $flags = $status \-> {\*(Aqflags\*(Aq}; \& print "File: $file: Status: ", join (\*(Aq \*(Aq, @$flags), "\en"; \& \& if (grep { $_ eq \*(Aqindex_renamed\*(Aq } @$flags) { \& print "Index previous filename: ", \& $status \-> {\*(Aqindex\*(Aq} \-> {\*(Aqold_file\*(Aq}, "\en"; \& } \& \& if (grep { $_ eq \*(Aqworktree_renamed\*(Aq } @$flags) { \& print "Worktree previous filename: ", \& $status \-> {\*(Aqworktree\*(Aq} \-> {\*(Aqold_file\*(Aq}, "\en"; \& } \& } .Ve .ie n .SS "merge_base( @objects )" .el .SS "merge_base( \f(CW@objects\fP )" .IX Subsection "merge_base( @objects )" Find the merge base between \f(CW@objects\fR. Each element in \f(CW@objects\fR should be peelable to a Git::Raw::Commit object, that is, it should be a Git::Raw::Commit or Git::Raw::Reference object, or alternatively a commit id or commit id prefix. .ie n .SS "merge_analysis( $reference )" .el .SS "merge_analysis( \f(CW$reference\fP )" .IX Subsection "merge_analysis( $reference )" Analyzes the given \f(CW$reference\fR and determines the opportunities for merging them into the \s-1HEAD\s0 of the repository. This function returns an array reference with optional members \f(CW"normal"\fR, \f(CW"up_to_date"\fR, \f(CW"fast_forward"\fR and/or \&\f(CW"unborn"\fR. .IP "\(bu" 4 \&\*(L"normal\*(R" .Sp A \*(L"normal\*(R" merge. Both \s-1HEAD\s0 and the given merge input have diverged from their common ancestor. The divergent commits must be merged. .IP "\(bu" 4 \&\*(L"up_to_date\*(R" .Sp All given merge inputs are reachable from \s-1HEAD,\s0 meaning the repository is up-to-date and no merge needs to be performed. .IP "\(bu" 4 \&\*(L"fast_forward\*(R" .Sp The given merge input is a fast-forward from \s-1HEAD\s0 and no merge needs to be performed. Instead, the given merge input may be checked out. .IP "\(bu" 4 \&\*(L"unborn\*(R" .Sp The \s-1HEAD\s0 of the current repository is \*(L"unborn\*(R" and does not point to a valid commit. No merge can be performed, but the caller may wish to simply set \&\s-1HEAD\s0 to the target commit(s). .ie n .SS "merge( $ref, [\e%merge_opts, \e%checkout_opts])" .el .SS "merge( \f(CW$ref\fP, [\e%merge_opts, \e%checkout_opts])" .IX Subsection "merge( $ref, [%merge_opts, %checkout_opts])" Merge the given \f(CW$ref\fR into \s-1HEAD,\s0 writing the results into the working directory. Any changes are staged for commit and any conflicts are written to the index. The index should be inspected for conflicts after this method completes and any conflicts should be resolved. At this stage a commit may be created to finalise the merge. .IP "\(bu" 4 \&\*(L"flags\*(R" .Sp Merge flags. Valid values include: .RS 4 .IP "\(bu" 8 \&\*(L"find_renames\*(R" .Sp Detect renames. .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"file_flags\*(R" .Sp See \f(CW\*(C`Git::Raw::Index\->merge()\*(C'\fR for options. .IP "\(bu" 4 \&\*(L"favor\*(R" .Sp Specify content automerging behaviour. Valid values are \f(CW"ours"\fR, \f(CW"theirs"\fR, and \f(CW"union"\fR. .IP "\(bu" 4 \&\*(L"rename_threshold\*(R" .Sp Similarity metric for considering a file renamed (default is 50). .IP "\(bu" 4 \&\*(L"target_limit\*(R" .Sp Maximum similarity sources to examine (overrides the \f(CW"merge.renameLimit"\fR configuration entry) (default is 200). .PP Example: .PP .Vb 11 \& my $branch = Git::Raw::Branch \-> lookup($repo, \*(Aqbranch\*(Aq, 1); \& my $analysis = $repo \-> merge_analysis($branch); \& my $merge_opts = { \& \*(Aqfavor\*(Aq => \*(Aqtheirs\*(Aq \& }; \& my $checkout_opts = { \& \*(Aqcheckout_strategy\*(Aq => { \& \*(Aqforce\*(Aq => 1 \& } \& }; \& $repo \-> merge($branch1, $merge_opts, $checkout_opts); .Ve .ie n .SS "ignore( $rules )" .el .SS "ignore( \f(CW$rules\fP )" .IX Subsection "ignore( $rules )" Add an ignore rules to the repository. The format of the rules is the same one of the \f(CW\*(C`.gitignore\*(C'\fR file (see the \f(CWgitignore(5)\fR manpage). Example: .PP .Vb 1 \& $repo \-> ignore("*.o\en"); .Ve .ie n .SS "path_is_ignored( $path )" .el .SS "path_is_ignored( \f(CW$path\fP )" .IX Subsection "path_is_ignored( $path )" Checks the ignore rules to see if they would apply to the given file. This indicates if the file would be ignored regardless of whether the file is already in the index or committed to the repository. .SS "diff( [\e%diff_opts] )" .IX Subsection "diff( [%diff_opts] )" Compute the Git::Raw::Diff between the repo's default index and another tree. Valid fields for the \f(CW%diff_opts\fR hash are: .IP "\(bu" 4 \&\*(L"tree\*(R" .Sp If provided, the diff is computed between \f(CW"tree"\fR and the repo's default index. The default is the repo's working directory. .IP "\(bu" 4 \&\*(L"flags\*(R" .Sp Flags for generating the diff. Valid values include: .RS 4 .IP "\(bu" 8 \&\*(L"reverse\*(R" .Sp Reverse the sides of the diff. .IP "\(bu" 8 \&\*(L"include_ignored\*(R" .Sp Include ignored files in the diff. .IP "\(bu" 8 \&\*(L"include_typechange\*(R" .Sp Enable the generation of typechange delta records. .IP "\(bu" 8 \&\*(L"recurse_ignored_dirs\*(R" .Sp Even if \f(CW"include_ignored"\fR is specified, an entire ignored directory will be marked with only a single entry in the diff. This flag adds all files under the directory as ignored entries, too. .IP "\(bu" 8 \&\*(L"include_untracked\*(R" .Sp Include untracked files in the diff. .IP "\(bu" 8 \&\*(L"recurse_untracked_dirs\*(R" .Sp Even if \f(CW"include_untracked"\fR is specified, an entire untracked directory will be marked with only a single entry in the diff (core git behaviour). This flag adds all files under untracked directories as untracked entries, too. .IP "\(bu" 8 \&\*(L"ignore_filemode\*(R" .Sp Ignore file mode changes. .IP "\(bu" 8 \&\*(L"ignore_case\*(R" .Sp Use case insensitive filename comparisons. .IP "\(bu" 8 \&\*(L"ignore_submodules\*(R" .Sp Treat all submodules as unmodified. .IP "\(bu" 8 \&\*(L"ignore_whitespace\*(R" .Sp Ignore all whitespace. .IP "\(bu" 8 \&\*(L"ignore_whitespace_change\*(R" .Sp Ignore changes in amount of whitespace. .IP "\(bu" 8 \&\*(L"ignore_whitespace_eol\*(R" .Sp Ignore whitespace at end of line. .IP "\(bu" 8 \&\*(L"skip_binary_check\*(R" .Sp Disable updating of the binary flag in delta records. This is useful when iterating over a diff if you don't need hunk and data callbacks and want to avoid having to load file completely. .IP "\(bu" 8 \&\*(L"enable_fast_untracked_dirs\*(R" .Sp When diff finds an untracked directory, to match the behavior of core git, it scans the contents for ignored and untracked files. If all contents are ignore, then the directory is ignored. If any contents are not ignored, then the directory is untracked. This is extra work that may not matter in many cases. This flag turns off that scan and immediately labels an untracked directory as untracked (changing the behavior to not match core git). .IP "\(bu" 8 \&\*(L"show_untracked_content\*(R" .Sp Include the content of untracked files. This implies \f(CW"include_untracked"\fR. .IP "\(bu" 8 \&\*(L"show_unmodified\*(R" .Sp Include the names of unmodified files. .IP "\(bu" 8 \&\*(L"patience\*(R" .Sp Use the \f(CW"patience diff"\fR algorithm. .IP "\(bu" 8 \&\*(L"minimal\*(R" .Sp Take extra time to find minimal diff. .IP "\(bu" 8 \&\*(L"show_binary\*(R" .Sp Include the necessary deflate / delta information so that \f(CW\*(C`git apply\*(C'\fR can apply given diff information to binary files. .IP "\(bu" 8 \&\*(L"force_text\*(R" .Sp Treat all files as text, disabling binary attributes and detection. .IP "\(bu" 8 \&\*(L"force_binary\*(R" .Sp Treat all files as binary, disabling text diffs. .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"prefix\*(R" .RS 4 .IP "\(bu" 8 \&\*(L"a\*(R" .Sp The virtual \f(CW"directory"\fR to prefix to old file names in hunk headers. (Default is \f(CW"a"\fR.) .IP "\(bu" 8 \&\*(L"b\*(R" .Sp The virtual \f(CW"directory"\fR to prefix to new file names in hunk headers. (Default is \f(CW"b"\fR.) .RE .RS 4 .RE .IP "\(bu" 4 \&\*(L"context_lines\*(R" .Sp The number of unchanged lines that define the boundary of a hunk (and to display before and after) .IP "\(bu" 4 \&\*(L"interhunk_lines\*(R" .Sp The maximum number of unchanged lines between hunk boundaries before the hunks will be merged into a one. .IP "\(bu" 4 \&\*(L"paths\*(R" .Sp A list of paths to constrain diff. .ie n .SS "blob( $buffer )" .el .SS "blob( \f(CW$buffer\fP )" .IX Subsection "blob( $buffer )" Create a new Git::Raw::Blob. Shortcut for \f(CW\*(C`Git::Raw::Blob\->create()\*(C'\fR. .ie n .SS "branch( $name, $target )" .el .SS "branch( \f(CW$name\fP, \f(CW$target\fP )" .IX Subsection "branch( $name, $target )" Create a new Git::Raw::Branch. Shortcut for \f(CW\*(C`Git::Raw::Branch\->create()\*(C'\fR. .SS "branches( [$type] )" .IX Subsection "branches( [$type] )" Retrieve a list of Git::Raw::Branch objects. Possible values for \f(CW$type\fR include \f(CW"local"\fR, \f(CW"remote"\fR or \f(CW"all"\fR. .ie n .SS "commit( $msg, $author, $committer, \e@parents, $tree [, $update_ref ] )" .el .SS "commit( \f(CW$msg\fP, \f(CW$author\fP, \f(CW$committer\fP, \e@parents, \f(CW$tree\fP [, \f(CW$update_ref\fP ] )" .IX Subsection "commit( $msg, $author, $committer, @parents, $tree [, $update_ref ] )" Create a new Git::Raw::Commit. Shortcut for \f(CW\*(C`Git::Raw::Commit\->create()\*(C'\fR. .ie n .SS "tag( $name, $msg, $tagger, $target )" .el .SS "tag( \f(CW$name\fP, \f(CW$msg\fP, \f(CW$tagger\fP, \f(CW$target\fP )" .IX Subsection "tag( $name, $msg, $tagger, $target )" Create a new Git::Raw::Tag. Shortcut for \f(CW\*(C`Git::Raw::Tag\->create()\*(C'\fR. .SS "tags( [$type] )" .IX Subsection "tags( [$type] )" Retrieve the list of annotated and/or lightweight tag objects. Possible values for \f(CW$type\fR include \f(CW"all"\fR, \f(CW"annotated"\fR or \f(CW"lightweight"\fR. .ie n .SS "stash( $repo, $msg )" .el .SS "stash( \f(CW$repo\fP, \f(CW$msg\fP )" .IX Subsection "stash( $repo, $msg )" Save the local modifications to a new stash. Shortcut for \f(CW\*(C`Git::Raw::Stash\->save()\*(C'\fR. .SS "remotes( )" .IX Subsection "remotes( )" Retrieve the list of Git::Raw::Remote objects. .SS "refs( )" .IX Subsection "refs( )" Retrieve the list of Git::Raw::Reference objects. .SS "walker( )" .IX Subsection "walker( )" Create a new Git::Raw::Walker. Shortcut for \f(CW\*(C`Git::Raw::Walker\->create()\*(C'\fR. .SS "path( )" .IX Subsection "path( )" Retrieve the complete path of the repository. .SS "workdir( [$new_dir] )" .IX Subsection "workdir( [$new_dir] )" Retrieve the working directory of the repository. If \f(CW$new_dir\fR is passed, the working directory of the repository will be set to the directory. .ie n .SS "blame( $path )" .el .SS "blame( \f(CW$path\fP )" .IX Subsection "blame( $path )" Retrieve blame information for \f(CW$path\fR. Returns a Git::Raw::Blame object. .ie n .SS "cherry_pick( $commit, [\e%merge_opts, \e%checkout_opts, $mainline] )" .el .SS "cherry_pick( \f(CW$commit\fP, [\e%merge_opts, \e%checkout_opts, \f(CW$mainline\fP] )" .IX Subsection "cherry_pick( $commit, [%merge_opts, %checkout_opts, $mainline] )" Cherry-pick the given \f(CW$commit\fR, producing changes in the index and working directory. See \f(CW\*(C`Git::Raw::Repository\->merge()\*(C'\fR for valid \f(CW%merge_opts\fR and \f(CW%checkout_opts\fR values. For merge commits \f(CW$mainline\fR specifies the parent. .ie n .SS "revert( $commit, [\e%merge_opts, \e%checkout_opts, $mainline] )" .el .SS "revert( \f(CW$commit\fP, [\e%merge_opts, \e%checkout_opts, \f(CW$mainline\fP] )" .IX Subsection "revert( $commit, [%merge_opts, %checkout_opts, $mainline] )" Revert the given \f(CW$commit\fR, producing changes in the index and working directory. See \f(CW\*(C`Git::Raw::Repository\->merge()\*(C'\fR for valid \f(CW%merge_opts\fR and \f(CW%checkout_opts\fR values. For merge commits \f(CW$mainline\fR specifies the parent. .ie n .SS "revparse( $spec )" .el .SS "revparse( \f(CW$spec\fP )" .IX Subsection "revparse( $spec )" Parse the revision string \f(CW$spec\fR to for \f(CW\*(C`from\*(C'\fR, \f(CW\*(C`to\*(C'\fR and \f(CW\*(C`intent\*(C'\fR. Returns a list of objects in list context and the number of objects parsed from \f(CW$spec\fR in scalar context. .PP .Vb 2 \& my ($from, $to) = $repo \-> revparse(\*(AqHEAD~..HEAD\*(Aq); \& print "Range is $from \-> $to", "\en"; .Ve .SS "state( )" .IX Subsection "state( )" Determine the state of the repository. One of the following values is returned: .IP "\(bu" 4 \&\*(L"none\*(R" .Sp Normal state .IP "\(bu" 4 \&\*(L"merge\*(R" .Sp Repository is in a merge. .IP "\(bu" 4 \&\*(L"revert\*(R" .Sp Repository is in a revert. .IP "\(bu" 4 \&\*(L"cherry_pick\*(R" .Sp Repository is in a cherry-pick. .IP "\(bu" 4 \&\*(L"bisect\*(R" .Sp Repository is bisecting. .IP "\(bu" 4 \&\*(L"rebase\*(R" .Sp Repository is rebasing. .IP "\(bu" 4 \&\*(L"rebase_interactive\*(R" .Sp Repository is in an interactive rebase. .IP "\(bu" 4 \&\*(L"rebase_merge\*(R" .Sp Repository is in an rebase merge. .IP "\(bu" 4 \&\*(L"apply_mailbox\*(R" .Sp Repository is applying patches. .IP "\(bu" 4 \&\*(L"mailbox_or_rebase\*(R" .Sp Repository is applying patches or rebasing. .SS "state_cleanup( )" .IX Subsection "state_cleanup( )" Remove all the metadata associated with an ongoing command like merge, revert, cherry-pick, etc. .SS "message( )" .IX Subsection "message( )" Retrieve the content of git's prepared message i.e. \f(CW".git/MERGE_MSG"\fR. .SS "is_empty( )" .IX Subsection "is_empty( )" Check if the repository is empty. .SS "is_bare( )" .IX Subsection "is_bare( )" Check if the repository is bare. .SS "is_shallow( )" .IX Subsection "is_shallow( )" Check if the repository is a shallow clone. .SS "is_head_detached( )" .IX Subsection "is_head_detached( )" Check if the repository's \f(CW\*(C`HEAD\*(C'\fR is detached, that is, it points directly to a commit. .SH "AUTHOR" .IX Header "AUTHOR" Alessandro Ghedini .PP Jacques Germishuys .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2012 Alessandro Ghedini. .PP This program is free software; you can redistribute it and/or modify it under the terms of either: the \s-1GNU\s0 General Public License as published by the Free Software Foundation; or the Artistic License. .PP See http://dev.perl.org/licenses/ for more information.