summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: efa615b)
raw | patch | inline | side by side (parent: efa615b)
author | Petr Baudis <pasky@suse.cz> | |
Wed, 9 May 2007 10:49:41 +0000 (12:49 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 10 May 2007 21:13:29 +0000 (14:13 -0700) |
This patch renames config_boolean() to config_bool() for consistency with
the commandline interface and because it is shorter but still obvious. ;-)
It also changes the return value from some obscure string to real Perl
boolean, allowing for clean user code.
Signed-off-by: Petr Baudis <pasky@suse.cz>
the commandline interface and because it is shorter but still obvious. ;-)
It also changes the return value from some obscure string to real Perl
boolean, allowing for clean user code.
Signed-off-by: Petr Baudis <pasky@suse.cz>
git-remote.perl | patch | blob | history | |
git-send-email.perl | patch | blob | history | |
perl/Git.pm | patch | blob | history |
diff --git a/git-remote.perl b/git-remote.perl
index 52013fe76dba73e19244fadf63f91677ce8e6a40..576379912793c9740620892cd3ee1cf7d2f18cfe 100755 (executable)
--- a/git-remote.perl
+++ b/git-remote.perl
} elsif ($name eq 'default') {
undef @remotes;
for (sort keys %$remote) {
- my $do_fetch = $git->config_boolean("remote." . $_ .
+ my $do_fetch = $git->config_bool("remote." . $_ .
".skipDefaultUpdate");
- if (!defined($do_fetch) || $do_fetch ne "true") {
+ unless ($do_fetch) {
push @remotes, $_;
}
}
diff --git a/git-send-email.perl b/git-send-email.perl
index a6e3e026199a8d5ce763360c60ee0491f14820a5..404095f258f1eafd8f247257c2416c9dba86364b 100755 (executable)
--- a/git-send-email.perl
+++ b/git-send-email.perl
$term = new FakeTerm "$@: going non-interactive";
}
-my $def_chain = $repo->config_boolean('sendemail.chainreplyto');
-if ($def_chain and $def_chain eq 'false') {
+my $def_chain = $repo->config_bool('sendemail.chainreplyto');
+if (defined $def_chain and not $def_chain) {
$chain_reply_to = 0;
}
diff --git a/perl/Git.pm b/perl/Git.pm
index b5b1cf5edcd860e88c461c600d3fa841654fef76..8fd36117539b528173e84f1df3acfc754ccc868f 100644 (file)
--- a/perl/Git.pm
+++ b/perl/Git.pm
}
-=item config_boolean ( VARIABLE )
+=item config_bool ( VARIABLE )
-Retrieve the boolean configuration C<VARIABLE>.
+Retrieve the bool configuration C<VARIABLE>. The return value
+is usable as a boolean in perl (and C<undef> if it's not defined,
+of course).
Must be called on a repository instance.
=cut
-sub config_boolean {
+sub config_bool {
my ($self, $var) = @_;
$self->repo_path()
or throw Error::Simple("not a repository");
try {
- return $self->command_oneline('config', '--bool', '--get',
+ my $val = $self->command_oneline('config', '--bool', '--get',
$var);
+ return undef unless defined $val;
+ return $val eq 'true';
} catch Git::Error::Command with {
my $E = shift;
if ($E->value() == 1) {