git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Add config_boolean() method to the Git perl module
@ 2007-02-20 20:13 Theodore Ts'o
  2007-02-20 20:13 ` [PATCH 2/2] Allow git-remote to update named groups of remotes Theodore Ts'o
  2007-02-20 21:16 ` [PATCH 1/2] Add config_boolean() method to the Git perl module Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Theodore Ts'o @ 2007-02-20 20:13 UTC (permalink / raw)
  To: git; +Cc: Theodore Ts'o

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 perl/Git.pm |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/perl/Git.pm b/perl/Git.pm
index f2c156c..51bd73e 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -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 )
-- 
1.5.0.1.38.g392d-dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-20 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-20 20:13 [PATCH 1/2] Add config_boolean() method to the Git perl module Theodore Ts'o
2007-02-20 20:13 ` [PATCH 2/2] Allow git-remote to update named groups of remotes Theodore Ts'o
2007-02-20 21:16 ` [PATCH 1/2] Add config_boolean() method to the Git perl module Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).