diff options
author | Frank Lichtenheld <frank@lichtenheld.de> | 2008-03-14 18:29:29 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-03-15 01:43:56 -0700 |
commit | 44617928ae4731b6139d87b978ddbc4860154222 (patch) | |
tree | d8a862a206a5de44fdc1c07d3855abf23fe69fba /perl | |
parent | c2e357c2fe23ff900de158067ca11e5021e22741 (diff) | |
download | git-44617928ae4731b6139d87b978ddbc4860154222.tar.gz git-44617928ae4731b6139d87b978ddbc4860154222.tar.xz |
Git.pm: Don't require repository instance for ident
git var doesn't require to be called in a repository anymore,
so don't require it either.
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Git.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/perl/Git.pm b/perl/Git.pm index 67b3749f0..2e7f896ba 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -632,15 +632,15 @@ The synopsis is like: "$name <$email>" eq ident_person($name); $time_tz =~ /^\d+ [+-]\d{4}$/; -Both methods must be called on a repository instance. - =cut sub ident { - my ($self, $type) = @_; + my ($self, $type) = _maybe_self(@_); my $identstr; if (lc $type eq lc 'committer' or lc $type eq lc 'author') { - $identstr = $self->command_oneline('var', 'GIT_'.uc($type).'_IDENT'); + my @cmd = ('var', 'GIT_'.uc($type).'_IDENT'); + unshift @cmd, $self if $self; + $identstr = command_oneline(@cmd); } else { $identstr = $type; } @@ -652,8 +652,8 @@ sub ident { } sub ident_person { - my ($self, @ident) = @_; - $#ident == 0 and @ident = $self->ident($ident[0]); + my ($self, @ident) = _maybe_self(@_); + $#ident == 0 and @ident = $self ? $self->ident($ident[0]) : ident($ident[0]); return "$ident[0] <$ident[1]>"; } |