[PATCH 1/2] teach mklog to get name / email from git config when available

segher@kernel.crashing.org segher@kernel.crashing.org
Tue Apr 29 15:47:00 GMT 2014


> +# if this is a git tree then take name and email from the git configuration
> +if (-d .git) {
> +  $gitname = `git config user.name`;
> +  chomp($gitname);
> +  if ($gitname) {
> +	  $name = $gitname;
> +  }
> +
> +  $gitaddr = `git config user.email`;
> +  chomp($gitaddr);
> +  if ($gitaddr) {
> +	  $addr = $gitaddr;
> +  }
> +}

"-d .git" is, erm, not so great.

How about something like

sub get_git_config {
  my $res = `git config --get @_`;
  return undef if $?;
  chomp $res;
  return $res;
}


Segher



More information about the Gcc-patches mailing list