1
0
mirror of https://github.com/git/git.git synced 2024-09-22 05:31:42 +02:00

Add config_boolean() method to the Git perl module

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Theodore Ts'o 2007-02-20 15:13:42 -05:00 committed by Junio C Hamano
parent 4a6b9bb60a
commit 7b9a13ece8

View File

@ -516,6 +516,36 @@ sub config {
}
=item config_boolean ( VARIABLE )
Retrieve the boolean configuration C<VARIABLE>.
Must be called on a repository instance.
This currently wraps command('config') so it is not so fast.
=cut
sub config_boolean {
my ($self, $var) = @_;
$self->repo_path()
or throw Error::Simple("not a repository");
try {
return $self->command_oneline('config', '--bool', '--get',
$var);
} catch Git::Error::Command with {
my $E = shift;
if ($E->value() == 1) {
# Key not found.
return undef;
} else {
throw $E;
}
};
}
=item ident ( TYPE | IDENTSTR )
=item ident_person ( TYPE | IDENTSTR | IDENTARRAY )