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:
committed by
Junio C Hamano
parent
3cb8caf729
commit
c7a30e5684
@ -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');
|
||||
|
||||
Reference in New Issue
Block a user