3 my $v = $ENV{VERSION} // die 'VERSION unset';
4 my $f = './lib/PublicInbox.pm';
5 if (-d ($ENV{GIT_DIR} // '.git') || -f '.git') {
6 chomp(my $gv = `git describe --match "v[0-9]*" HEAD`);
8 substr($gv, 0, 1, ''); # remove "v"
9 system(qw(git update-index -q --refresh));
10 if (my @n = `git diff-index --name-only HEAD --`) {
17 if (-f $f && do $f && (eval('$PublicInbox::VERSION') // 'undef') eq $v) {
20 my $tmp = "$f.tmp.$$";
21 open my $fh, '>', $tmp or die "open($tmp): $!";
22 print $fh <<EOM or die "print($tmp): $!";
23 # this file is generated by $0
28 close $fh or die "close($tmp): $!";
29 rename($tmp, $f) or die "rename($tmp, $f): $!";