allow option to release from a different branch
[p5sagit/Distar.git] / helpers / preflight
index 186285e..a923c9d 100755 (executable)
@@ -5,8 +5,13 @@ use Config;
 use File::Spec;
 use File::Find;
 use ExtUtils::MakeMaker ();
+use Getopt::Long qw(:config gnu_getopt);
 
-my $version = $ARGV[0] or die "version required!";
+GetOptions(
+  "branch=s"     => \(my $branch = 'master'),
+) or die("Error in command line arguments\n");
+
+my $version = shift or die "version required!";
 
 my $make = $Config{make};
 my $null = File::Spec->devnull;
@@ -29,7 +34,7 @@ for (scalar `"$make" manifest 2>&1 >$null`) {
 }
 
 for (scalar `git status`) {
-  /^(?:# )?On branch master/ || die "Not on master. EEEK";
+  /^(?:# )?On branch \Q$branch\E/ || die "Not on $branch. EEEK";
   /Your branch is behind|Your branch and .*? have diverged/ && die "Not synced with upstream";
 }