Skip to content

Commit

Permalink
Git.pm: Don't require repository instance for ident
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Frank Lichtenheld authored and Junio C Hamano committed Mar 15, 2008
1 parent c2e357c commit 4461792
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions perl/Git.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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]>";
}

Expand Down

0 comments on commit 4461792

Please sign in to comment.