1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-02 01:16:12 +02:00

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>
This commit is contained in:
Frank Lichtenheld 2008-03-14 18:29:29 +01:00 committed by Junio C Hamano
parent c2e357c2fe
commit 44617928ae

View File

@ -632,15 +632,15 @@ sub get_color {
"$name <$email>" eq ident_person($name); "$name <$email>" eq ident_person($name);
$time_tz =~ /^\d+ [+-]\d{4}$/; $time_tz =~ /^\d+ [+-]\d{4}$/;
Both methods must be called on a repository instance.
=cut =cut
sub ident { sub ident {
my ($self, $type) = @_; my ($self, $type) = _maybe_self(@_);
my $identstr; my $identstr;
if (lc $type eq lc 'committer' or lc $type eq lc 'author') { 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 { } else {
$identstr = $type; $identstr = $type;
} }
@ -652,8 +652,8 @@ sub ident {
} }
sub ident_person { sub ident_person {
my ($self, @ident) = @_; my ($self, @ident) = _maybe_self(@_);
$#ident == 0 and @ident = $self->ident($ident[0]); $#ident == 0 and @ident = $self ? $self->ident($ident[0]) : ident($ident[0]);
return "$ident[0] <$ident[1]>"; return "$ident[0] <$ident[1]>";
} }