--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings FATAL => 'all';
+
+use CPAN::Meta;
+use Parse::CPAN::Meta;
+
+my $file = shift || die "need a file";
+my $meta = Parse::CPAN::Meta->load_file($file);
+
+my $commit = `git rev-parse HEAD`;
+chomp $commit;
+$meta->{x_vcs_commit} = $commit;
+
+my $tag = `git describe`;
+chomp $tag;
+$meta->{x_vcs_tag} = $tag;
+
+CPAN::Meta->new($meta)->save($file, { version => ($file =~ /\.yml$/ ? 1 : 2) });
$out;
}
+ sub metafile_target {
+ my $self = shift;
+ my $metafile_target = $self->SUPER::metafile_target(@_);
+ for (qw(META.yml META.json)) {
+ my $add = "\t\$(NOECHO) \$(ABSPERLRUN) $(HELPERS)/add-git-commit \$(DISTVNAME)/$_\n";
+ $metafile_target =~ s{(.*\b\Q$_\E\b[^\n]*\n)}{$1$add}s;
+ }
+ $metafile_target;
+ }
+
sub dist_test {
my $self = shift;