This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH: [perl #121292] wrong perlunicode BOM claims
[perl5.git] / Porting / make_dot_patch.pl
index 4cc7f84..71c4604 100755 (executable)
@@ -8,7 +8,7 @@ use warnings;
 # It tries to find which of our primary branches the sha1 can be found on,
 # and then prints to standard out something similar to what our rsync feed
 # would produce for that situation. The main difference being, in that case
-# we KNOW what branch we are on, and in this one we dont, and in that case
+# we KNOW what branch we are on, and in this one we don't, and in that case
 # the $tstamp field holds the time the snapshot was generated (so that multiple
 # fetches will always have an increasing tstamp field), however in this case
 # we use the commit date of the sha1.
@@ -20,33 +20,8 @@ use warnings;
 #
 # Yves
 
-use POSIX qw(strftime);
-sub isotime { strftime "%Y-%m-%d.%H:%M:%S",gmtime(shift||time) }
+use lib "Porting";
+use GitUtils qw(gen_dot_patch);
+print gen_dot_patch(@ARGV), -t STDOUT ? "\n" : "";
 
-my $target= shift || 'HEAD';
-chomp(my ($git_dir, $is_bare, $sha1)=`git rev-parse --git-dir --is-bare-repository $target`);
-die "Not in a git repository!" if !$git_dir;
-$is_bare= "" if $is_bare and $is_bare eq 'false';
-my @branches=(
-          'blead',
-          'maint-5.10',
-          'maint-5.8',
-          'maint-5.8-dor',
-          'maint-5.6',
-          'maint-5.005',
-          'maint-5.004',
-);
-my $reftype= $is_bare ? "heads" : "remotes/origin";
-my $branch;
-foreach my $name (@branches) {
-    my $cmd= "git name-rev --name-only --refs=refs/$reftype/$name $sha1";
-    chomp($branch= `$cmd`);
-    last if $branch ne 'undefined';
-}
-$branch ||= "error";
-$branch =~ s!^\Q$reftype\E/!!;
-$branch =~ s![~^].*\z!!;
-my $tstamp= isotime(`git log -1 --pretty="format:%ct" $sha1`);
-chomp(my $describe= `git describe`);
-print join(" ", $branch, $tstamp, $sha1, $describe) . "\n";