Add Error.pm to the distribution
[gitweb.git] / perl / Git.pm
index 8fff785e024f575c95778931361aad0eff38a349..dcd769b4d1ef121e37f156f8580fb63ce39cf816 100644 (file)
@@ -48,7 +48,7 @@ =head1 SYNOPSIS
 
 # Methods which can be called as standalone functions as well:
 @EXPORT_OK = qw(command command_oneline command_pipe command_noisy
-                hash_object);
+                version exec_path hash_object);
 
 
 =head1 DESCRIPTION
@@ -122,9 +122,6 @@ =head1 CONSTRUCTORS
 If the directory does not have the subdirectory, C<WorkingCopy> is left
 undefined and C<Repository> is pointed to the directory itself.
 
-B<GitPath> - Path to the C<git> binary executable. By default the C<$PATH>
-is searched for it.
-
 You should not use both C<Directory> and either of C<Repository> and
 C<WorkingCopy> - the results of that are undefined.
 
@@ -288,6 +285,31 @@ sub command_noisy {
 }
 
 
+=item version ()
+
+Return the Git version in use.
+
+Implementation of this function is very fast; no external command calls
+are involved.
+
+=cut
+
+# Implemented in Git.xs.
+
+
+=item exec_path ()
+
+Return path to the git sub-command executables (the same as
+C<git --exec-path>). Useful mostly only internally.
+
+Implementation of this function is very fast; no external command calls
+are involved.
+
+=cut
+
+# Implemented in Git.xs.
+
+
 =item hash_object ( FILENAME [, TYPE ] )
 
 =item hash_object ( FILEHANDLE [, TYPE ] )
@@ -350,11 +372,14 @@ sub _cmd_exec {
                $self->{opts}->{Repository} and $ENV{'GIT_DIR'} = $self->{opts}->{Repository};
                $self->{opts}->{WorkingCopy} and chdir($self->{opts}->{WorkingCopy});
        }
-       my $git = $self->{opts}->{GitPath};
-       $git ||= 'git';
-       exec ($git, @args) or croak "exec failed: $!";
+       xs__execv_git_cmd(@args);
+       croak "exec failed: $!";
 }
 
+# Execute the given Git command ($_[0]) with arguments ($_[1..])
+# by searching for it at proper places.
+# _execv_git_cmd(), implemented in Git.xs.
+
 # Close pipe to a subprocess.
 sub _cmd_close {
        my ($fh) = @_;