Git.pm: Introduce ident() and ident_person() methods

These methods can retrieve/parse the author/committer ident.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Petr Baudis
2006-07-03 22:48:01 +02:00
committed by Junio C Hamano
parent 3cb8caf729
commit c7a30e5684
2 changed files with 51 additions and 9 deletions

View File

@ -84,15 +84,8 @@ foreach my $entry (@bcclist) {
# Now, let's fill any that aren't set in with defaults:
sub gitvar_ident {
my ($name) = @_;
my $val = $repo->command('var', $name);
my @field = split(/\s+/, $val);
return join(' ', @field[0...(@field-3)]);
}
my ($author) = gitvar_ident('GIT_AUTHOR_IDENT');
my ($committer) = gitvar_ident('GIT_COMMITTER_IDENT');
my ($author) = $repo->ident_person('author');
my ($committer) = $repo->ident_person('committer');
my %aliases;
my @alias_files = $repo->config('sendemail.aliasesfile');