has_git
has_git( $version, \%options );
Checks if there is a git binary available, or skips all tests.
If the optional $version argument is provided, also checks if the available git binary has a version
greater or equal to $version.
This function also accepts an option hash of the same kind as those accepted by Git::Repository and
Git::Repository::Command.
This function must be called before "plan()", as it performs a skip_all if requirements are not met.
"has_git" is now obsolete and will print a warning when used. The "test_requires_git" function provided
by the Test::Requires::Git module is a much more flexible replacement.
"has_git" will be removed in a future release.
test_repository
test_repository( %options );
Creates a new empty git repository in a temporary location, and returns a Git::Repository object pointing
to it.
This function takes options as a hash. Each key will influence a different part of the creation process.
The keys are:
temp
Array reference containing parameters to File::Temp "tempdir" function.
Default: "<[ CLEANUP =" 1 ]>>
init
Array reference containing parameters to "git init". Must not contain the target directory
parameter, which is provided by "test_repository()" (via File::Temp).
Default: "[]"
The "init" option is only supported with Git versions higher or equal to 1.6.2.rc0.
clone
Array reference containing parameters to "git clone". Must not contain the target directory
parameter, which is provided by "test_repository()" (via File::Temp).
Note that "clone" and "init" are mutually exclusive and that "test_repository()" will croak if both
are provided. This option has no default value, since at least a Git URL must be provided to the
"clone" option.
The "clone" option is only supported with Git versions higher or equal to 1.6.2.rc0.
git Hash reference containing options for Git::Repository.
Default: "{}"
This call is the equivalent of the default call with no options:
test_repository(
temp => [ CLEANUP => 1 ], # File::Temp::tempdir options
init => [], # git init options
git => {}, # Git::Repository options
);
To create a bare repository:
test_repository( init => [ '--bare' ] );
To leave the repository in its location after the end of the test:
test_repository( temp => [ CLEANUP => 0 ] );
Note that since "test_repository()" uses "git init" to create the test repository, it requires at least
Git version "1.5.0.rc1".