summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85e9c7e)
raw | patch | inline | side by side (parent: 85e9c7e)
author | Cord Seele <cowose@googlemail.com> | |
Fri, 30 Sep 2011 10:52:24 +0000 (12:52 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 30 Sep 2011 19:34:38 +0000 (12:34 -0700) |
Use --path option when calling 'git config' thus allow for pathname
expansion, e.g. a tilde.
Signed-off-by: Cord Seele <cowose@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
expansion, e.g. a tilde.
Signed-off-by: Cord Seele <cowose@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
perl/Git.pm | patch | blob | history |
diff --git a/perl/Git.pm b/perl/Git.pm
index a86ab709c25b5e110aa2708941cea560f82c1fa8..c279bfb2446880bb18a5e6c898ef533805e78e56 100644 (file)
--- a/perl/Git.pm
+++ b/perl/Git.pm
};
}
+
+=item config_path ( VARIABLE )
+
+Retrieve the path configuration C<VARIABLE>. The return value
+is an expanded path or C<undef> if it's not defined.
+
+This currently wraps command('config') so it is not so fast.
+
+=cut
+
+sub config_path {
+ my ($self, $var) = _maybe_self(@_);
+
+ try {
+ my @cmd = ('config', '--path');
+ unshift @cmd, $self if $self;
+ if (wantarray) {
+ return command(@cmd, '--get-all', $var);
+ } else {
+ return command_oneline(@cmd, '--get', $var);
+ }
+ } catch Git::Error::Command with {
+ my $E = shift;
+ if ($E->value() == 1) {
+ # Key not found.
+ return undef;
+ } else {
+ throw $E;
+ }
+ };
+}
+
=item config_int ( VARIABLE )
Retrieve the integer configuration C<VARIABLE>. The return value