]> arthur.barton.de Git - bup.git/blob - format-subst.pl
Makefile: fix test pattern to include t/test.sh
[bup.git] / format-subst.pl
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4
5 sub fix($) {
6     my $s = shift;
7     chomp $s;
8     return $s;
9 }
10
11 sub ex
12 {
13   my ($cmd) = @_;
14   my $result = `$cmd` or die 'FAILED: ' . $cmd;
15   return $result;
16 }
17
18 while (<>) {
19     s{
20         \$Format:\%d\$
21     }{
22         my $tag = fix(ex('git describe --always --match="[0-9]*"'));
23         "(tag: bup-$tag)"
24     }ex;
25     
26     s{ 
27         \$Format:([^\$].*)\$
28     }{
29         fix(ex("git log -1 --pretty=format:'$1'"))
30     }ex;
31     print;
32 }